public interface PropertyAccessor
An implementation of this interface will often require that its target objects all be of some particular type. For example, the MapPropertyAccessor class requires that its targets all implement the java.util.Map interface.
Note that the "name" of a property is represented by a generic Object. Some implementations may require properties' names to be Strings, while others may allow them to be other types---for example, ArrayPropertyAccessor treats Number names as indexes into the target object, which must be an array.
Modifier and Type | Method and Description |
---|---|
Object |
getProperty(Map context,
Object target,
Object name)
Extracts and returns the property of the given name from the given target object.
|
void |
setProperty(Map context,
Object target,
Object name,
Object value)
Sets the value of the property of the given name in the given target object.
|
Object getProperty(Map context, Object target, Object name) throws OgnlException
target
- the object to get the property fromname
- the name of the property to getOgnlException
- if there is an error locating the property in the given objectvoid setProperty(Map context, Object target, Object name, Object value) throws OgnlException
target
- the object to set the property inname
- the name of the property to setvalue
- the new value for the propertyOgnlException
- if there is an error setting the property in the given object