Class ClassUtil

java.lang.Object
com.groiss.util.ClassUtil

public class ClassUtil extends Object
Utility for loading classes and creating instances. Checked exceptions are wrapped into ApplicationException. The class loader returned from Settings.getClassLoader() is used.
  • Method Details

    • getClasses

      public static <T> List<Class<T>> getClasses(String clazzNames)
      Load the classes from the given class names.
      Parameters:
      clazzNames - list of class names separated by comma, newline, or carriage return.
      Returns:
      class objects
    • instantiate

      public static <T> T instantiate(String clazzName)
      Load a class and create an instance.
      Parameters:
      clazzName - name of a class
      Returns:
      instance of given class
    • instantiate

      public static <T> List<T> instantiate(List<Class<T>> clazzes)
      Call the default constructor for each element of the given list of classes.
      Parameters:
      clazzes - list of classes
      Returns:
      instances of the classes