Package net.sf.jasperreports.engine.util
Class ClassUtils
- java.lang.Object
-
- net.sf.jasperreports.engine.util.ClassUtils
-
public final class ClassUtils extends java.lang.ObjectClass utilities.- Author:
- Lucian Chirita (lucianc@users.sourceforge.net)
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringEXCEPTION_MESSAGE_KEY_CLASS_INSTANCE_ERRORstatic java.lang.StringEXCEPTION_MESSAGE_KEY_CLASS_LOADING_ERRORstatic java.lang.StringEXCEPTION_MESSAGE_KEY_CLASS_UNEXPECTED_TYPE
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.List<java.lang.Class<?>>getInterfaces(java.lang.Class<?> clazz)static java.lang.ObjectinstantiateClass(java.lang.String className, java.lang.Class<?> expectedType)Instantiates a class.
-
-
-
Field Detail
-
EXCEPTION_MESSAGE_KEY_CLASS_INSTANCE_ERROR
public static final java.lang.String EXCEPTION_MESSAGE_KEY_CLASS_INSTANCE_ERROR
- See Also:
- Constant Field Values
-
EXCEPTION_MESSAGE_KEY_CLASS_LOADING_ERROR
public static final java.lang.String EXCEPTION_MESSAGE_KEY_CLASS_LOADING_ERROR
- See Also:
- Constant Field Values
-
EXCEPTION_MESSAGE_KEY_CLASS_UNEXPECTED_TYPE
public static final java.lang.String EXCEPTION_MESSAGE_KEY_CLASS_UNEXPECTED_TYPE
- See Also:
- Constant Field Values
-
-
Method Detail
-
instantiateClass
public static final java.lang.Object instantiateClass(java.lang.String className, java.lang.Class<?> expectedType)Instantiates a class.The class is expected to have a public no-argument constructor.
- Parameters:
className- the class nameexpectedType- the expected (super) type of the result- Returns:
- a newly created instance of the specified class
- Throws:
JRRuntimeException- if the class cannot be loaded or instantiated, or if it does not implement the expected type
-
getInterfaces
public static java.util.List<java.lang.Class<?>> getInterfaces(java.lang.Class<?> clazz)
- Parameters:
clazz-- Returns:
- a list of interfaces implemented by this class and by its superclasses, or an empty list in case there are no implemented interfaces
-
-