Top Description Constructors Methods
org.springframework.objenesis.instantiator.util

public final Class ClassUtils

extends Object
Class Inheritance
Imports
org.springframework.objenesis.ObjenesisException

Helper class for to play with classes.
Author
Henri Tremblay

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static String

Returns:

the internal name
classNameToInternalClassName
(String
full class name including the package
className
)

Will convert a class name to its name in the class definition format (e.g org.springframework.objenesis.EmptyClass becomes org.springframework.objenesis/EmptyClass)

public static String

Returns:

the resource name
classNameToResource
(String
full class name including the package
className
)

Will convert a class name to its class loader resource name (e.g org.springframework.objenesis.EmptyClass becomes org.springframework.objenesis/EmptyClass.class)

public static <
type of the class returned
T
>
Class<T>

Returns:

the class if it already exists or null
getExistingClass
(ClassLoader
Class loader where to search the class
classLoader
,
String
Class name with full path
className
)

Check if this class already exists in the class loader and return it if it does

public static <T> T
newInstance(Class<T> clazz)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ClassUtilsback to summary
private ClassUtils()

Method Detail

classNameToInternalClassNameback to summary
public static String classNameToInternalClassName(String className)

Will convert a class name to its name in the class definition format (e.g org.springframework.objenesis.EmptyClass becomes org.springframework.objenesis/EmptyClass)

Parameters
className:String

full class name including the package

Returns:String

the internal name

classNameToResourceback to summary
public static String classNameToResource(String className)

Will convert a class name to its class loader resource name (e.g org.springframework.objenesis.EmptyClass becomes org.springframework.objenesis/EmptyClass.class)

Parameters
className:String

full class name including the package

Returns:String

the resource name

getExistingClassback to summary
public static <T> Class<T> getExistingClass(ClassLoader classLoader, String className)

Check if this class already exists in the class loader and return it if it does

Parameters
<T>
type of the class returned
classLoader:ClassLoader

Class loader where to search the class

className:String

Class name with full path

Returns:Class<T>

the class if it already exists or null

Annotations
@SuppressWarnings:unchecked
newInstanceback to summary
public static <T> T newInstance(Class<T> clazz)
Annotations
@SuppressWarnings:deprecation