Class ReflectionUtils

java.lang.Object
org.apache.commons.crypto.utils.ReflectionUtils

public final class ReflectionUtils extends Object
General utility methods for working with reflection.
  • Method Details

    • getClassByName

      public static Class<?> getClassByName(String name) throws ClassNotFoundException
      Loads a class by name.
      Parameters:
      name - the class name.
      Returns:
      the class object.
      Throws:
      ClassNotFoundException - if the class is not found.
    • newInstance

      public static <T> T newInstance(Class<T> klass, Object... args)
      Uses the constructor represented by this Constructor object to create and initialize a new instance of the constructor's declaring class, with the specified initialization parameters.
      Type Parameters:
      T - type for the new instance
      Parameters:
      klass - the Class object.
      args - array of objects to be passed as arguments to the constructor call.
      Returns:
      a new object created by calling the constructor this object represents.