public interface ReflectionProvider
| Modifier and Type | Method and Description |
|---|---|
void |
copy(Object from,
Object to,
Map<String,Object> context,
Collection<String> exclusions,
Collection<String> inclusions)
Copies the properties in the object "from" and sets them in the object "to"
using specified type converter, or
XWorkConverter if none
is specified. |
Map<String,Object> |
getBeanMap(Object source)
Creates a Map with read properties for the given source object.
|
Field |
getField(Class inClass,
String name) |
Method |
getGetMethod(Class targetClass,
String propertyName) |
PropertyDescriptor |
getPropertyDescriptor(Class targetClass,
String propertyName)
This method returns a PropertyDescriptor for the given class and property name using
a Map lookup (using getPropertyDescriptorsMap()).
|
PropertyDescriptor[] |
getPropertyDescriptors(Object source)
Get's the java beans property descriptors for the given source.
|
Object |
getRealTarget(String property,
Map<String,Object> context,
Object root)
Looks for the real target with the specified property given a root Object which may be a
CompoundRoot.
|
Method |
getSetMethod(Class targetClass,
String propertyName) |
Object |
getValue(String expression,
Map<String,Object> context,
Object root)
Evaluates the given OGNL expression to extract a value from the given root
object in a given context
|
void |
setProperties(Map<String,?> properties,
Object o)
Sets the properties on the object using the default context, defaulting to not throwing
exceptions for problems setting the properties.
|
void |
setProperties(Map<String,?> props,
Object o,
Map<String,Object> context)
Sets the object's properties using the default type converter, defaulting to not throw
exceptions for problems setting the properties.
|
void |
setProperties(Map<String,?> props,
Object o,
Map<String,Object> context,
boolean throwPropertyExceptions)
Sets the object's properties using the default type converter.
|
void |
setProperty(String name,
Object value,
Object o,
Map<String,Object> context)
Sets the named property to the supplied value on the Object, defaults to not throwing
property exceptions.
|
void |
setProperty(String name,
Object value,
Object o,
Map<String,Object> context,
boolean throwPropertyExceptions)
Sets the named property to the supplied value on the Object,
|
void |
setValue(String expression,
Map<String,Object> context,
Object root,
Object value)
Evaluates the given OGNL expression to insert a value into the object graph
rooted at the given root object given the context.
|
Method getGetMethod(Class targetClass, String propertyName) throws IntrospectionException, ReflectionException
Method getSetMethod(Class targetClass, String propertyName) throws IntrospectionException, ReflectionException
void setProperties(Map<String,?> props, Object o, Map<String,Object> context)
props - the properties being seto - the objectcontext - the action contextvoid setProperties(Map<String,?> props, Object o, Map<String,Object> context, boolean throwPropertyExceptions) throws ReflectionException
props - the properties being seto - the objectcontext - the action contextthrowPropertyExceptions - boolean which tells whether it should throw exceptions for
problems setting the propertiesReflectionExceptionvoid setProperties(Map<String,?> properties, Object o)
properties - property mapo - objectPropertyDescriptor getPropertyDescriptor(Class targetClass, String propertyName) throws IntrospectionException, ReflectionException
targetClass - target class of the property descriptorpropertyName - property nameIntrospectionException - in case of introspection errorReflectionException - in case of reflection problemsvoid copy(Object from, Object to, Map<String,Object> context, Collection<String> exclusions, Collection<String> inclusions)
XWorkConverter if none
is specified.from - the source objectto - the target objectcontext - the action context we're running underexclusions - collection of method names to excluded from copying ( can be null)inclusions - collection of method names to included copying (can be null)
note if exclusions AND inclusions are supplied and not null nothing will get copied.Object getRealTarget(String property, Map<String,Object> context, Object root) throws ReflectionException
property - specified propertycontext - the contextroot - the root objectReflectionException - in case of reflection problemsvoid setProperty(String name, Object value, Object o, Map<String,Object> context, boolean throwPropertyExceptions)
name - the name of the property to be setvalue - the value to set into the named propertyo - the object upon which to set the propertycontext - the context which may include the TypeConverterthrowPropertyExceptions - boolean which tells whether it should throw exceptions for
problems setting the propertiesvoid setProperty(String name, Object value, Object o, Map<String,Object> context)
name - the name of the property to be setvalue - the value to set into the named propertyo - the object upon which to set the propertycontext - the context which may include the TypeConverterMap<String,Object> getBeanMap(Object source) throws IntrospectionException, ReflectionException
If the source object does not have a read property (i.e. write-only) then
the property is added to the map with the value here is no read method for property-name.
source - the source object.IntrospectionException - is thrown if an exception occurs during introspection.ReflectionExceptionObject getValue(String expression, Map<String,Object> context, Object root) throws ReflectionException
expression - the OGNL expression to be parsedcontext - the naming context for the evaluationroot - the root object for the OGNL expressionReflectionExceptionvoid setValue(String expression, Map<String,Object> context, Object root, Object value) throws ReflectionException
expression - the OGNL expression to be parsedroot - the root object for the OGNL expressioncontext - the naming context for the evaluationvalue - the value to insert into the object graphReflectionExceptionPropertyDescriptor[] getPropertyDescriptors(Object source) throws IntrospectionException
source - the source object.IntrospectionException - is thrown if an exception occurs during introspection.Copyright © 2000–2017 Apache Software Foundation. All rights reserved.