Package org.apache.el.util
Class ReflectionUtil
- java.lang.Object
-
- org.apache.el.util.ReflectionUtil
-
public class ReflectionUtil extends java.lang.ObjectUtilities for Managing Serialization and Reflection.
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.String[]PRIMITIVE_NAMESNames of Java primitive types.protected static java.lang.Class<?>[]PRIMITIVESClass objects for Java primitive types, in the same order asPRIMITIVE_NAMES.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.Class<?>forName(java.lang.String name)Loads a class by name, supporting primitive types and array notation.protected static java.lang.Class<?>forNamePrimitive(java.lang.String name)Looks up a primitive class by name.static java.lang.reflect.MethodgetMethod(EvaluationContext ctx, java.lang.Object base, java.lang.Object property, java.lang.Class<?>[] paramTypes, java.lang.Object[] paramValues)Returns a method based on the criteria.static java.lang.Class<?>[]toTypeArray(java.lang.String[] s)Converts an array of Class names to Class types.static java.lang.String[]toTypeNameArray(java.lang.Class<?>[] c)Converts an array of Class types to Class names.
-
-
-
Field Detail
-
PRIMITIVE_NAMES
protected static final java.lang.String[] PRIMITIVE_NAMES
Names of Java primitive types.
-
PRIMITIVES
protected static final java.lang.Class<?>[] PRIMITIVES
Class objects for Java primitive types, in the same order asPRIMITIVE_NAMES.
-
-
Method Detail
-
forName
public static java.lang.Class<?> forName(java.lang.String name) throws java.lang.ClassNotFoundExceptionLoads a class by name, supporting primitive types and array notation.- Parameters:
name- the class name to load- Returns:
- the Class object, or
nullif the name is empty - Throws:
java.lang.ClassNotFoundException- if the class cannot be found
-
forNamePrimitive
protected static java.lang.Class<?> forNamePrimitive(java.lang.String name)
Looks up a primitive class by name.- Parameters:
name- the primitive type name- Returns:
- the corresponding Class object, or
nullif not a primitive
-
toTypeArray
public static java.lang.Class<?>[] toTypeArray(java.lang.String[] s) throws java.lang.ClassNotFoundExceptionConverts an array of Class names to Class types.- Parameters:
s- The array of class names- Returns:
- An array of Class instance where the element at index i in the result is an instance of the class with the name at index i in the input
- Throws:
java.lang.ClassNotFoundException- If a class of a given name cannot be found
-
toTypeNameArray
public static java.lang.String[] toTypeNameArray(java.lang.Class<?>[] c)
Converts an array of Class types to Class names.- Parameters:
c- The array of class instances- Returns:
- An array of Class names where the element at index i in the result is the name of the class instance at index i in the input
-
getMethod
public static java.lang.reflect.Method getMethod(EvaluationContext ctx, java.lang.Object base, java.lang.Object property, java.lang.Class<?>[] paramTypes, java.lang.Object[] paramValues) throws MethodNotFoundException
Returns a method based on the criteria.- Parameters:
ctx- the context in which the expression is being evaluatedbase- the object that owns the methodproperty- the name of the methodparamTypes- the parameter types to useparamValues- the parameter values- Returns:
- the method specified
- Throws:
MethodNotFoundException- If a method cannot be found that matches the given criteria
-
-