Interface Resolver
- All Known Implementing Classes:
- DefaultResolver
public interface Resolver
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 expression
     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- PropertyUtilsBean.getIndexedProperty(Object, String)
- PropertyUtilsBean.getMappedProperty(Object, String)
- PropertyUtilsBean.getNestedProperty(Object, String)
- PropertyUtilsBean.getPropertyDescriptor(Object, String)
- PropertyUtilsBean.getSimpleProperty(Object, String)
- PropertyUtilsBean.setIndexedProperty(Object, String, Object)
- PropertyUtilsBean.setMappedProperty(Object, String, Object)
- PropertyUtilsBean.setNestedProperty(Object, String, Object)
- PropertyUtilsBean.setSimpleProperty(Object, String, Object)
 
- BeanUtilsBean
- LocaleBeanUtilsBean
- Since:
- 1.8.0
- See Also:
- 
Method SummaryModifier and TypeMethodDescriptionintExtract the index value from the property expression or -1.Extract the map key from the property expression ornull.getProperty(String expression) Gets the property name from the property expression.booleanIndicates whether or not the expression contains nested property expressions or not.booleanIndicate whether the expression is for an indexed property or not.booleanIndicate whether the expression is for a mapped property or not.Extract the next property expression from the current expression.Remove the last property expression from the current expression.
- 
Method Details- 
getIndexExtract the index value from the property expression or -1.- Parameters:
- expression- The property expression
- Returns:
- The index value or -1 if the property is not indexed
- Throws:
- IllegalArgumentException- If the indexed property is illegally formed or has an invalid (non-numeric) value
 
- 
getKeyExtract the map key from the property expression ornull.- Parameters:
- expression- The property expression
- Returns:
- The index value
- Throws:
- IllegalArgumentException- If the mapped property is illegally formed
 
- 
getPropertyGets the property name from the property expression.- Parameters:
- expression- The property expression
- Returns:
- The property name
 
- 
hasNestedIndicates whether or not the expression contains nested property expressions or not.- Parameters:
- expression- The property expression
- Returns:
- The next property expression
 
- 
isIndexedIndicate whether the expression is for an indexed property or not.- Parameters:
- expression- The property expression
- Returns:
- trueif the expression is indexed, otherwise- false
 
- 
isMappedIndicate whether the expression is for a mapped property or not.- Parameters:
- expression- The property expression
- Returns:
- trueif the expression is mapped, otherwise- false
 
- 
nextExtract the next property expression from the current expression.- Parameters:
- expression- The property expression
- Returns:
- The next property expression
 
- 
removeRemove the last property expression from the current expression.- Parameters:
- expression- The property expression
- Returns:
- The new expression value, with first property expression removed - null if there are no more expressions
 
 
-