Class ReflectionUtil
java.lang.Object
org.apache.el.util.ReflectionUtil
Utilities for Managing Serialization and Reflection.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final String[]Names of Java primitive types.protected static final Class<?>[]Class objects for Java primitive types, in the same order asPRIMITIVE_NAMES. -
Method Summary
Modifier and TypeMethodDescriptionstatic Class<?> Loads a class by name, supporting primitive types and array notation.protected static Class<?> forNamePrimitive(String name) Looks up a primitive class by name.static MethodgetMethod(EvaluationContext ctx, Object base, Object property, Class<?>[] paramTypes, Object[] paramValues) Returns a method based on the criteria.static Class<?>[]toTypeArray(String[] s) Converts an array of Class names to Class types.static String[]toTypeNameArray(Class<?>[] c) Converts an array of Class types to Class names.
-
Field Details
-
PRIMITIVE_NAMES
Names of Java primitive types. -
PRIMITIVES
Class objects for Java primitive types, in the same order asPRIMITIVE_NAMES.
-
-
Method Details
-
forName
Loads 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:
ClassNotFoundException- if the class cannot be found
-
forNamePrimitive
-
toTypeArray
Converts 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:
ClassNotFoundException- If a class of a given name cannot be found
-
toTypeNameArray
-
getMethod
public static Method getMethod(EvaluationContext ctx, Object base, Object property, Class<?>[] paramTypes, 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
-