Example usage for org.apache.commons.beanutils.expression Resolver getKey

List of usage examples for org.apache.commons.beanutils.expression Resolver getKey

Introduction

In this page you can find the example usage for org.apache.commons.beanutils.expression Resolver getKey.

Prototype

String getKey(String expression);

Source Link

Document

Extract the map key from the property expression or null.

Usage

From source file:nl.ucan.navigate.NestedPath.java

private void setProperty(PathContext pathContext, Object value) throws IllegalAccessException,
        InvocationTargetException, NoSuchMethodException, InstantiationException, IntrospectionException {
    if (pathContext.getPaths().size() > 0) {
        String lastPathElement = getLastElement(pathContext);
        Object lastPathInstance = getLastInstance(pathContext);
        Resolver resolver = pub.getResolver();
        String prop = resolver.getProperty(lastPathElement);
        if (resolver.isMapped(lastPathElement)) {
            ///*from  w w  w  .  j  av a2  s. co m*/
            // mapped property
            String key = resolver.getKey(lastPathElement);
            value = propertyValue.mapped(lastPathInstance, prop, key, value);
        } else if (resolver.isIndexed(lastPathElement)) {
            //
            // indexed property
            int idx = resolver.getIndex(lastPathElement);
            value = propertyValue.indexed(lastPathInstance, prop, idx, value);
        } else {
            //
            // simple property
            value = propertyValue.simple(lastPathInstance, lastPathElement, value);
        }
        pub.setProperty(lastPathInstance, lastPathElement, value);
    }
}