Package org.objenesis.instantiator.util
Class ClassUtils
java.lang.Object
org.objenesis.instantiator.util.ClassUtils
Helper class for to play with classes.
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
classNameToInternalClassName
(String className) Will convert a class name to its name in the class definition format (e.gorg.objenesis.EmptyClass
becomesorg/objenesis/EmptyClass
)static String
classNameToResource
(String className) Will convert a class name to its class loader resource name (e.gorg.objenesis.EmptyClass
becomesorg/objenesis/EmptyClass.class
)static <T> Class
<T> getExistingClass
(ClassLoader classLoader, String className) Check if this class already exists in the class loader and return it if it doesstatic <T> T
newInstance
(Class<T> clazz)
-
Method Details
-
classNameToInternalClassName
Will convert a class name to its name in the class definition format (e.gorg.objenesis.EmptyClass
becomesorg/objenesis/EmptyClass
)- Parameters:
className
- full class name including the package- Returns:
- the internal name
-
classNameToResource
Will convert a class name to its class loader resource name (e.gorg.objenesis.EmptyClass
becomesorg/objenesis/EmptyClass.class
)- Parameters:
className
- full class name including the package- Returns:
- the resource name
-
getExistingClass
Check if this class already exists in the class loader and return it if it does- Type Parameters:
T
- type of the class returned- Parameters:
classLoader
- Class loader where to search the classclassName
- Class name with full path- Returns:
- the class if it already exists or null
-
newInstance
-