Example usage for org.apache.commons.jxpath JXPathContext getContextBean

List of usage examples for org.apache.commons.jxpath JXPathContext getContextBean

Introduction

In this page you can find the example usage for org.apache.commons.jxpath JXPathContext getContextBean.

Prototype

public Object getContextBean() 

Source Link

Document

Returns the JavaBean associated with this context.

Usage

From source file:pt.webdetails.cdf.dd.model.inst.reader.cdfdejs.CdfdeJsComponentReader.java

public void read(TM builder, IThingReadContext context, JXPathContext source, String sourcePath) {
    // TODO: Other CDFDE component properties are not relevant now, 
    // but revisit this in the future.

    // Property Bindings
    Iterator<Map<String, Object>> mapIterator = source.iterate("properties");
    while (mapIterator.hasNext()) {
        Map<String, Object> map = mapIterator.next();
        Object name = map.get("name");
        Object type = map.get("type");
        Object value = map.get("value");

        builder.addPropertyBinding(//from   ww  w  .jav  a2  s.co  m
                new UnresolvedPropertyBinding.Builder().setAlias(name != null ? name.toString() : "") // matches prop/name
                        .setInputType(type != null ? type.toString() : "")
                        .setValue(value != null ? value.toString() : ""));
    }

    // Attributes
    Map<String, Object> jsComp = (Map<String, Object>) source.getContextBean();
    Set<String> keys = jsComp.keySet();
    for (String key : keys) {
        if (key.startsWith("meta_")) {
            String name = key.substring("meta_".length());
            builder.addAttribute(name, jsComp.get(key).toString());
        }
    }
}