Class ReflectionUtils
java.lang.Object
org.apache.commons.crypto.utils.ReflectionUtils
General utility methods for working with reflection.
-
Method Summary
Modifier and TypeMethodDescriptionstatic Class<?> getClassByName(String name) Loads a class by name.static <T> TnewInstance(Class<T> klass, Object... args) Uses the constructor represented by thisConstructorobject to create and initialize a new instance of the constructor's declaring class, with the specified initialization parameters.
-
Method Details
-
getClassByName
Loads a class by name.- Parameters:
name- the class name.- Returns:
- the class object.
- Throws:
ClassNotFoundException- if the class is not found.
-
newInstance
Uses the constructor represented by thisConstructorobject 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.
-