public abstract class OgnlRuntime extends Object
Modifier and Type | Field and Description |
---|---|
static int |
INDEXED_PROPERTY_INT
JavaBeans IndexedProperty
|
static int |
INDEXED_PROPERTY_NONE
Not an indexed property
|
static int |
INDEXED_PROPERTY_OBJECT
OGNL ObjectIndexedProperty
|
static Object[] |
NoArguments |
static Class[] |
NoArgumentTypes |
static Object |
NoConversionPossible
Token returned by TypeConverter for no conversion possible
|
static Object |
NotFound |
static List |
NotFoundList |
static Map |
NotFoundMap |
static String |
NULL_STRING |
Constructor and Description |
---|
OgnlRuntime() |
Modifier and Type | Method and Description |
---|---|
static boolean |
areArgsCompatible(Object[] args,
Class[] classes)
Tells whether the given array of objects is compatible with the given array of
classes---that is, whether the given array of objects can be passed as arguments
to a method or constructor whose parameter types are the given array of classes.
|
static Object |
callAppropriateMethod(OgnlContext context,
Object source,
Object target,
String methodName,
String propertyName,
List methods,
Object[] args) |
static Object |
callConstructor(OgnlContext context,
String className,
Object[] args) |
static Object |
callMethod(OgnlContext context,
Object target,
String methodName,
String propertyName,
Object[] args) |
static Object |
callStaticMethod(OgnlContext context,
String className,
String methodName,
Object[] args) |
static Class |
classForName(OgnlContext context,
String className) |
static Method |
getAppropriateMethod(OgnlContext context,
Object source,
Object target,
String methodName,
String propertyName,
List methods,
Object[] args,
Object[] actualArgs)
Gets the appropriate method to be called for the given target, method name and arguments.
|
static Class |
getArgClass(Object arg)
Gets the class for a method argument that is appropriate for looking up methods
by reflection, by looking for the standard primitive wrapper classes and
exchanging for them their underlying primitive class objects.
|
static String |
getBaseName(Object o)
Returns the base name (the class name without the
package name prepended) of the object given.
|
static String |
getClassBaseName(Class c)
Returns the base name (the class name without the
package name prepended) of the class given.
|
static String |
getClassName(Class c,
boolean fullyQualified) |
static String |
getClassName(Object o,
boolean fullyQualified) |
static String |
getClassPackageName(Class c)
Returns the package name of the class given.
|
static List |
getConstructors(Class targetClass) |
static Constructor |
getConvertedConstructorAndArgs(OgnlContext context,
Object target,
List constructors,
Object[] args,
Object[] newArgs) |
static Method |
getConvertedMethodAndArgs(OgnlContext context,
Object target,
String propertyName,
List methods,
Object[] args,
Object[] newArgs) |
static Object |
getConvertedType(OgnlContext context,
Object target,
Member member,
String propertyName,
Object value,
Class type) |
static boolean |
getConvertedTypes(OgnlContext context,
Object target,
Member member,
String propertyName,
Class[] parameterTypes,
Object[] args,
Object[] newArgs) |
static List |
getDeclaredMethods(Class targetClass,
String propertyName,
boolean findSets) |
static ElementsAccessor |
getElementsAccessor(Class cls) |
static EvaluationPool |
getEvaluationPool() |
static Field |
getField(Class inClass,
String name) |
static Map |
getFields(Class targetClass) |
static Object |
getFieldValue(OgnlContext context,
Object target,
String propertyName) |
static Object |
getFieldValue(OgnlContext context,
Object target,
String propertyName,
boolean checkAccessAndExistence) |
static Method |
getGetMethod(OgnlContext context,
Class targetClass,
String propertyName) |
static Object |
getIndexedProperty(OgnlContext context,
Object source,
String name,
Object index) |
static int |
getIndexedPropertyType(OgnlContext context,
Class sourceClass,
String name)
Determines the index property type, if any.
|
static MethodAccessor |
getMethodAccessor(Class cls) |
static Map |
getMethods(Class targetClass,
boolean staticMethods) |
static List |
getMethods(Class targetClass,
String name,
boolean staticMethods) |
static Object |
getMethodValue(OgnlContext context,
Object target,
String propertyName) |
static Object |
getMethodValue(OgnlContext context,
Object target,
String propertyName,
boolean checkAccessAndExistence)
If the checkAccessAndExistence flag is true this method will check to see if the
method exists and if it is accessible according to the context's MemberAccess.
|
static String |
getModifierString(int modifiers) |
static NullHandler |
getNullHandler(Class cls) |
static ObjectArrayPool |
getObjectArrayPool() |
static String |
getPackageName(Object o)
Returns the package name of the object's class.
|
static Class[] |
getParameterTypes(Constructor c)
Returns the parameter types of the given method.
|
static Class[] |
getParameterTypes(Method m)
Returns the parameter types of the given method.
|
static Permission |
getPermission(Method method)
Permission will be named "invoke.
|
static String |
getPointerString(int num)
Returns a "pointer" string in the usual format for these
things - 0x
|
static String |
getPointerString(Object o)
Returns a "pointer" string in the usual format for these
things - 0x
|
static Object |
getPrimitiveDefaultValue(Class forClass) |
static Object |
getProperty(OgnlContext context,
Object source,
Object name) |
static PropertyAccessor |
getPropertyAccessor(Class cls) |
static PropertyDescriptor |
getPropertyDescriptor(Class targetClass,
String propertyName)
This method returns a PropertyDescriptor for the given class and property name using
a Map lookup (using getPropertyDescriptorsMap()).
|
static PropertyDescriptor |
getPropertyDescriptorFromArray(Class targetClass,
String name)
Gets the property descriptor with the given name for the target class given.
|
static Map |
getPropertyDescriptors(Class targetClass)
This method returns the property descriptors for the given class as a Map
|
static PropertyDescriptor[] |
getPropertyDescriptorsArray(Class targetClass) |
static SecurityManager |
getSecurityManager()
Gets the SecurityManager that OGNL uses to determine permissions for
invoking methods.
|
static Method |
getSetMethod(OgnlContext context,
Class targetClass,
String propertyName) |
static Object |
getStaticField(OgnlContext context,
String className,
String fieldName) |
static Class |
getTargetClass(Object o)
Gets the "target" class of an object for looking up accessors that
are registered on the target.
|
static String |
getUniqueDescriptor(Object object)
Returns a unique descriptor string that includes the object's
class' base name and a unique integer identifier.
|
static String |
getUniqueDescriptor(Object object,
boolean fullyQualified)
Returns a unique descriptor string that includes the object's
class and a unique integer identifier.
|
static boolean |
hasField(OgnlContext context,
Object target,
Class inClass,
String propertyName) |
static boolean |
hasGetMethod(OgnlContext context,
Object target,
Class targetClass,
String propertyName) |
static boolean |
hasGetProperty(OgnlContext context,
Object target,
Object oname) |
static boolean |
hasSetMethod(OgnlContext context,
Object target,
Class targetClass,
String propertyName) |
static boolean |
hasSetProperty(OgnlContext context,
Object target,
Object oname) |
static Object |
invokeMethod(Object target,
Method method,
Object[] argsArray) |
static boolean |
isFieldAccessible(OgnlContext context,
Object target,
Class inClass,
String propertyName) |
static boolean |
isFieldAccessible(OgnlContext context,
Object target,
Field field,
String propertyName) |
static boolean |
isInstance(OgnlContext context,
Object value,
String className) |
static boolean |
isMethodAccessible(OgnlContext context,
Object target,
Method method,
String propertyName) |
static boolean |
isMoreSpecific(Class[] classes1,
Class[] classes2)
Tells whether the first array of classes is more specific than the second.
|
static boolean |
isTypeCompatible(Object object,
Class c)
Tells whether the given object is compatible with the given class
---that is, whether the given object can be passed as an argument
to a method or constructor whose parameter type is the given class.
|
static void |
setElementsAccessor(Class cls,
ElementsAccessor accessor) |
static boolean |
setFieldValue(OgnlContext context,
Object target,
String propertyName,
Object value) |
static void |
setIndexedProperty(OgnlContext context,
Object source,
String name,
Object index,
Object value) |
static void |
setMethodAccessor(Class cls,
MethodAccessor accessor) |
static boolean |
setMethodValue(OgnlContext context,
Object target,
String propertyName,
Object value) |
static boolean |
setMethodValue(OgnlContext context,
Object target,
String propertyName,
Object value,
boolean checkAccessAndExistence) |
static void |
setNullHandler(Class cls,
NullHandler handler) |
static void |
setProperty(OgnlContext context,
Object target,
Object name,
Object value) |
static void |
setPropertyAccessor(Class cls,
PropertyAccessor accessor) |
static void |
setSecurityManager(SecurityManager value)
Sets the SecurityManager that OGNL uses to determine permissions for
invoking methods.
|
static Object[] |
toArray(List list)
Utility to convert a List into an Object[] array.
|
public static final Object NotFound
public static final List NotFoundList
public static final Map NotFoundMap
public static final Object[] NoArguments
public static final Class[] NoArgumentTypes
public static final Object NoConversionPossible
public static int INDEXED_PROPERTY_NONE
public static int INDEXED_PROPERTY_INT
public static int INDEXED_PROPERTY_OBJECT
public static final String NULL_STRING
public static Class getTargetClass(Object o)
public static String getBaseName(Object o)
public static String getClassBaseName(Class c)
public static String getPackageName(Object o)
public static String getClassPackageName(Class c)
public static String getPointerString(int num)
public static String getPointerString(Object o)
public static String getUniqueDescriptor(Object object, boolean fullyQualified)
public static String getUniqueDescriptor(Object object)
public static Object[] toArray(List list)
public static Class[] getParameterTypes(Method m)
public static Class[] getParameterTypes(Constructor c)
public static SecurityManager getSecurityManager()
public static void setSecurityManager(SecurityManager value)
value
- SecurityManager to setpublic static Permission getPermission(Method method)
public static Object invokeMethod(Object target, Method method, Object[] argsArray) throws InvocationTargetException, IllegalAccessException
public static final Class getArgClass(Object arg)
arg
- an object that is being passed to a methodpublic static final boolean isTypeCompatible(Object object, Class c)
public static final boolean areArgsCompatible(Object[] args, Class[] classes)
public static final boolean isMoreSpecific(Class[] classes1, Class[] classes2)
public static final String getModifierString(int modifiers)
public static final Class classForName(OgnlContext context, String className) throws ClassNotFoundException
ClassNotFoundException
public static final boolean isInstance(OgnlContext context, Object value, String className) throws OgnlException
OgnlException
public static Object getConvertedType(OgnlContext context, Object target, Member member, String propertyName, Object value, Class type)
public static boolean getConvertedTypes(OgnlContext context, Object target, Member member, String propertyName, Class[] parameterTypes, Object[] args, Object[] newArgs)
public static Method getConvertedMethodAndArgs(OgnlContext context, Object target, String propertyName, List methods, Object[] args, Object[] newArgs)
public static Constructor getConvertedConstructorAndArgs(OgnlContext context, Object target, List constructors, Object[] args, Object[] newArgs)
public static Method getAppropriateMethod(OgnlContext context, Object source, Object target, String methodName, String propertyName, List methods, Object[] args, Object[] actualArgs)
public static Object callAppropriateMethod(OgnlContext context, Object source, Object target, String methodName, String propertyName, List methods, Object[] args) throws MethodFailedException
MethodFailedException
public static final Object callStaticMethod(OgnlContext context, String className, String methodName, Object[] args) throws OgnlException, MethodFailedException
OgnlException
MethodFailedException
public static final Object callMethod(OgnlContext context, Object target, String methodName, String propertyName, Object[] args) throws OgnlException, MethodFailedException
OgnlException
MethodFailedException
public static final Object callConstructor(OgnlContext context, String className, Object[] args) throws OgnlException
OgnlException
public static final Object getMethodValue(OgnlContext context, Object target, String propertyName) throws OgnlException, IllegalAccessException, NoSuchMethodException, IntrospectionException
public static final Object getMethodValue(OgnlContext context, Object target, String propertyName, boolean checkAccessAndExistence) throws OgnlException, IllegalAccessException, NoSuchMethodException, IntrospectionException
public static final boolean setMethodValue(OgnlContext context, Object target, String propertyName, Object value) throws OgnlException, IllegalAccessException, NoSuchMethodException, MethodFailedException, IntrospectionException
public static final boolean setMethodValue(OgnlContext context, Object target, String propertyName, Object value, boolean checkAccessAndExistence) throws OgnlException, IllegalAccessException, NoSuchMethodException, MethodFailedException, IntrospectionException
public static final List getMethods(Class targetClass, String name, boolean staticMethods)
public static final Object getFieldValue(OgnlContext context, Object target, String propertyName) throws NoSuchFieldException
NoSuchFieldException
public static final Object getFieldValue(OgnlContext context, Object target, String propertyName, boolean checkAccessAndExistence) throws NoSuchFieldException
NoSuchFieldException
public static final boolean setFieldValue(OgnlContext context, Object target, String propertyName, Object value) throws OgnlException
OgnlException
public static final boolean isFieldAccessible(OgnlContext context, Object target, Class inClass, String propertyName)
public static final boolean isFieldAccessible(OgnlContext context, Object target, Field field, String propertyName)
public static final boolean hasField(OgnlContext context, Object target, Class inClass, String propertyName)
public static final Object getStaticField(OgnlContext context, String className, String fieldName) throws OgnlException
OgnlException
public static final List getDeclaredMethods(Class targetClass, String propertyName, boolean findSets)
public static final Method getGetMethod(OgnlContext context, Class targetClass, String propertyName) throws IntrospectionException, OgnlException
IntrospectionException
OgnlException
public static final boolean isMethodAccessible(OgnlContext context, Object target, Method method, String propertyName)
public static final boolean hasGetMethod(OgnlContext context, Object target, Class targetClass, String propertyName) throws IntrospectionException, OgnlException
IntrospectionException
OgnlException
public static final Method getSetMethod(OgnlContext context, Class targetClass, String propertyName) throws IntrospectionException, OgnlException
IntrospectionException
OgnlException
public static final boolean hasSetMethod(OgnlContext context, Object target, Class targetClass, String propertyName) throws IntrospectionException, OgnlException
IntrospectionException
OgnlException
public static final boolean hasGetProperty(OgnlContext context, Object target, Object oname) throws IntrospectionException, OgnlException
IntrospectionException
OgnlException
public static final boolean hasSetProperty(OgnlContext context, Object target, Object oname) throws IntrospectionException, OgnlException
IntrospectionException
OgnlException
public static final Map getPropertyDescriptors(Class targetClass) throws IntrospectionException, OgnlException
IntrospectionException
OgnlException
public static final PropertyDescriptor getPropertyDescriptor(Class targetClass, String propertyName) throws IntrospectionException, OgnlException
IntrospectionException
OgnlException
public static final PropertyDescriptor[] getPropertyDescriptorsArray(Class targetClass) throws IntrospectionException
IntrospectionException
public static final PropertyDescriptor getPropertyDescriptorFromArray(Class targetClass, String name) throws IntrospectionException
targetClass
- Class for which property descriptor is desiredname
- Name of propertyIntrospectionException
public static final void setMethodAccessor(Class cls, MethodAccessor accessor)
public static final MethodAccessor getMethodAccessor(Class cls) throws OgnlException
OgnlException
public static final void setPropertyAccessor(Class cls, PropertyAccessor accessor)
public static final PropertyAccessor getPropertyAccessor(Class cls) throws OgnlException
OgnlException
public static final ElementsAccessor getElementsAccessor(Class cls) throws OgnlException
OgnlException
public static final void setElementsAccessor(Class cls, ElementsAccessor accessor)
public static final NullHandler getNullHandler(Class cls) throws OgnlException
OgnlException
public static final void setNullHandler(Class cls, NullHandler handler)
public static final Object getProperty(OgnlContext context, Object source, Object name) throws OgnlException
OgnlException
public static final void setProperty(OgnlContext context, Object target, Object name, Object value) throws OgnlException
OgnlException
public static final int getIndexedPropertyType(OgnlContext context, Class sourceClass, String name) throws OgnlException
INDEXED_PROPERTY_NONE
if the
property is not index-accessible as determined by OGNL or JavaBeans. If it is indexable
then this will return whether it is a JavaBeans indexed property, conforming to the
indexed property patterns (returns INDEXED_PROPERTY_INT
) or if it conforms
to the OGNL arbitrary object indexable (returns INDEXED_PROPERTY_OBJECT
).OgnlException
public static final Object getIndexedProperty(OgnlContext context, Object source, String name, Object index) throws OgnlException
OgnlException
public static final void setIndexedProperty(OgnlContext context, Object source, String name, Object index, Object value) throws OgnlException
OgnlException
public static EvaluationPool getEvaluationPool()
public static ObjectArrayPool getObjectArrayPool()