LBJ2.util
Class ClassUtils

java.lang.Object
  extended by LBJ2.util.ClassUtils

public class ClassUtils
extends java.lang.Object

Utility methods for retrieving various classes that are part of the LBJ class hierarchy by name.


Constructor Summary
ClassUtils()
           
 
Method Summary
static java.lang.Class getClass(java.lang.String name)
          Retrieves the Class object with the given name.
static java.lang.Class getClass(java.lang.String name, boolean exit)
          Retrieves the Class object with the given name.
static Classifier getClassifier(java.lang.String name)
          Retrieve a Classifier by name using the no-argument constructor.
static Classifier getClassifier(java.lang.String name, boolean exit)
          Retrieve a Classifier by name using the no-argument constructor.
static Classifier getClassifier(java.lang.String name, java.lang.Class[] paramTypes, java.lang.Object[] arguments)
          Retrieve a Classifier by name using a constructor with arguments.
static Classifier getClassifier(java.lang.String name, java.lang.Class[] paramTypes, java.lang.Object[] arguments, boolean exit)
          Retrieve a Classifier by name using a constructor with arguments.
static java.lang.reflect.Constructor getConstructor(java.lang.String name, java.lang.Class[] paramTypes)
          Retrieve the constructor of the given class with the given parameter types.
static java.lang.reflect.Constructor getConstructor(java.lang.String name, java.lang.Class[] paramTypes, boolean exit)
          Retrieve the constructor of the given class with the given parameter types.
static Learner getLearner(java.lang.String name)
          Retrieve a Learner by name using the no-argument constructor.
static Learner getLearner(java.lang.String name, boolean exit)
          Retrieve a Learner by name using the no-argument constructor.
static Learner getLearner(java.lang.String name, java.lang.Class[] paramTypes, java.lang.Object[] arguments)
          Retrieve a Learner by name using a constructor with arguments.
static Learner getLearner(java.lang.String name, java.lang.Class[] paramTypes, java.lang.Object[] arguments, boolean exit)
          Retrieve a Learner by name using a constructor with arguments.
static Parser getParser(java.lang.String name)
          Retrieve a Parser by name using the no-argument constructor.
static Parser getParser(java.lang.String name, boolean exit)
          Retrieve a Parser by name using the no-argument constructor.
static Parser getParser(java.lang.String name, java.lang.Class[] paramTypes, java.lang.Object[] arguments)
          Retrieve a Parser by name using a constructor with arguments.
static Parser getParser(java.lang.String name, java.lang.Class[] paramTypes, java.lang.Object[] arguments, boolean exit)
          Retrieve a Parser by name using a constructor with arguments.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassUtils

public ClassUtils()
Method Detail

getClass

public static java.lang.Class getClass(java.lang.String name)
Retrieves the Class object with the given name. If there is any exception thrown during retrieval, the program will print an error message to STDERR and terminate via System.exit(1).

Parameters:
name - The fully qualified name of the class.
Returns:
The class with the given name.

getClass

public static java.lang.Class getClass(java.lang.String name,
                                       boolean exit)
Retrieves the Class object with the given name.

Parameters:
name - The fully qualified name of the class.
exit - Whether or not to System.exit(1) on an exception.
Returns:
The class with the given name, or null if an exception was caught.

getConstructor

public static java.lang.reflect.Constructor getConstructor(java.lang.String name,
                                                           java.lang.Class[] paramTypes)
Retrieve the constructor of the given class with the given parameter types. If there is any exception thrown during retrieval, the program will print an error message to STDERR and terminate via System.exit(1).

Parameters:
name - The fully qualified name of the class.
paramTypes - The Classes representing the types of the constructor's parameters.
Returns:
The indicated constructor.

getConstructor

public static java.lang.reflect.Constructor getConstructor(java.lang.String name,
                                                           java.lang.Class[] paramTypes,
                                                           boolean exit)
Retrieve the constructor of the given class with the given parameter types.

Parameters:
name - The fully qualified name of the class.
paramTypes - The Classes representing the types of the constructor's parameters.
exit - Whether or not to System.exit(1) on an exception.
Returns:
The indicated constructor, or null if an exception was caught.

getClassifier

public static Classifier getClassifier(java.lang.String name)
Retrieve a Classifier by name using the no-argument constructor. If there is any exception thrown during retrieval, the program will print an error message to STDERR and terminate via System.exit(1).

Parameters:
name - The fully qualified name of the class.
Returns:
An instance of the classifier.

getClassifier

public static Classifier getClassifier(java.lang.String name,
                                       boolean exit)
Retrieve a Classifier by name using the no-argument constructor.

Parameters:
name - The fully qualified name of the class.
exit - Whether or not to System.exit(1) on an exception.
Returns:
An instance of the classifier, or null if an exception was caught.

getClassifier

public static Classifier getClassifier(java.lang.String name,
                                       java.lang.Class[] paramTypes,
                                       java.lang.Object[] arguments)
Retrieve a Classifier by name using a constructor with arguments. If there is any exception thrown during retrieval, the program will print an error message to STDERR and terminate via System.exit(1).

Parameters:
name - The fully qualified name of the class.
paramTypes - The Classes representing the types of the constructor's parameters.
arguments - The arguments to send to the constructor.
Returns:
An instance of the classifier.

getClassifier

public static Classifier getClassifier(java.lang.String name,
                                       java.lang.Class[] paramTypes,
                                       java.lang.Object[] arguments,
                                       boolean exit)
Retrieve a Classifier by name using a constructor with arguments.

Parameters:
name - The fully qualified name of the class.
paramTypes - The Classes representing the types of the constructor's parameters.
arguments - The arguments to send to the constructor.
exit - Whether or not to System.exit(1) on an exception.
Returns:
An instance of the classifier, or null if an exception was caught.

getLearner

public static Learner getLearner(java.lang.String name)
Retrieve a Learner by name using the no-argument constructor. If there is any exception thrown during retrieval, the program will print an error message to STDERR and terminate via System.exit(1).

Parameters:
name - The fully qualified name of the class.
Returns:
An instance of the learner.

getLearner

public static Learner getLearner(java.lang.String name,
                                 boolean exit)
Retrieve a Learner by name using the no-argument constructor.

Parameters:
name - The fully qualified name of the class.
exit - Whether or not to System.exit(1) on an exception.
Returns:
An instance of the learner, or null if an exception was caught.

getLearner

public static Learner getLearner(java.lang.String name,
                                 java.lang.Class[] paramTypes,
                                 java.lang.Object[] arguments)
Retrieve a Learner by name using a constructor with arguments. If there is any exception thrown during retrieval, the program will print an error message to STDERR and terminate via System.exit(1).

Parameters:
name - The fully qualified name of the class.
paramTypes - The Classes representing the types of the constructor's parameters.
arguments - The arguments to send to the constructor.
Returns:
An instance of the learner.

getLearner

public static Learner getLearner(java.lang.String name,
                                 java.lang.Class[] paramTypes,
                                 java.lang.Object[] arguments,
                                 boolean exit)
Retrieve a Learner by name using a constructor with arguments.

Parameters:
name - The fully qualified name of the class.
paramTypes - The Classes representing the types of the constructor's parameters.
arguments - The arguments to send to the constructor.
exit - Whether or not to System.exit(1) on an exception.
Returns:
An instance of the learner, or null if an exception was caught.

getParser

public static Parser getParser(java.lang.String name)
Retrieve a Parser by name using the no-argument constructor. If there is any exception thrown during retrieval, the program will print an error message to STDERR and terminate via System.exit(1).

Parameters:
name - The fully qualified name of the class.
Returns:
An instance of the parser.

getParser

public static Parser getParser(java.lang.String name,
                               boolean exit)
Retrieve a Parser by name using the no-argument constructor.

Parameters:
name - The fully qualified name of the class.
exit - Whether or not to System.exit(1) on an exception.
Returns:
An instance of the parser, or null if an exception was caught.

getParser

public static Parser getParser(java.lang.String name,
                               java.lang.Class[] paramTypes,
                               java.lang.Object[] arguments)
Retrieve a Parser by name using a constructor with arguments. If there is any exception thrown during retrieval, the program will print an error message to STDERR and terminate via System.exit(1).

Parameters:
name - The fully qualified name of the class.
paramTypes - The Classes representing the types of the constructor's parameters.
arguments - The arguments to send to the constructor.
Returns:
An instance of the parser.

getParser

public static Parser getParser(java.lang.String name,
                               java.lang.Class[] paramTypes,
                               java.lang.Object[] arguments,
                               boolean exit)
Retrieve a Parser by name using a constructor with arguments.

Parameters:
name - The fully qualified name of the class.
paramTypes - The Classes representing the types of the constructor's parameters.
arguments - The arguments to send to the constructor.
exit - Whether or not to System.exit(1) on an exception.
Returns:
An instance of the parser, or null if an exception was caught.