org.apache.commons.beanutils.expression.Resolver |
Known Indirect Subclasses |
Property Name Expression Resolver.
Methods such as PropertyUtilsBean's setNestedProperty()
method
use a Resolver
to process a property name
expression and resolve nested, indexed and mapped
property names. The following code provides an example usage
demonstrating all the methods:
// Iterate through a nested property expression while (resolver.hasNested(name)) { // isolate a single property from a nested expresion String next = resolver.next(name); // Process... String property = resolver.getProperty(next); if (resolver.isIndexed(next)) { int index = resolver.getIndex(next); bean = getIndexedProperty(bean, property, index); } else if (resolver.isMapped(next)) { String key = resolver.getKey(next); bean = getMappedProperty(bean, property, key); } else { bean = getSimpleProperty(bean, property); } // remove the processed property from the expression name = resolver.remove(name); }In order to create an implementation, it is important to understand how BeanUtils/PropertyUtils uses the
resolver
. The following are
the main methods that use it:
PropertyUtilsBean
getIndexedProperty(Object, String)
getMappedProperty(Object, String)
getNestedProperty(Object, String)
getPropertyDescriptor(Object, String)
getSimpleProperty(Object, String)
setIndexedProperty(Object, String, Object)
setMappedProperty(Object, String, Object)
setNestedProperty(Object, String, Object)
setSimpleProperty(Object, String, Object)
BeanUtilsBean
LocaleBeanUtilsBean
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Extract the index value from the property expression or -1.
| |||||||||||
Extract the map key from the property expression or
null . | |||||||||||
Return the property name from the property expression.
| |||||||||||
Indicates whether or not the expression
contains nested property expressions or not.
| |||||||||||
Indicate whether the expression is for an indexed property or not.
| |||||||||||
Indicate whether the expression is for a mapped property or not.
| |||||||||||
Extract the next property expression from the
current expression.
| |||||||||||
Remove the last property expresson from the
current expression.
|
Extract the index value from the property expression or -1.
expression | The property expression |
---|
IllegalArgumentException | If the indexed property is illegally formed or has an invalid (non-numeric) value |
---|
Extract the map key from the property expression or null
.
expression | The property expression |
---|
IllegalArgumentException | If the mapped property is illegally formed |
---|
Return the property name from the property expression.
expression | The property expression |
---|
Indicates whether or not the expression contains nested property expressions or not.
expression | The property expression |
---|
Indicate whether the expression is for an indexed property or not.
expression | The property expression |
---|
true
if the expresion is indexed,
otherwise false
Indicate whether the expression is for a mapped property or not.
expression | The property expression |
---|
true
if the expresion is mapped,
otherwise false
Extract the next property expression from the current expression.
expression | The property expression |
---|
Remove the last property expresson from the current expression.
expression | The property expression |
---|