// ------------------------------------------------------------------------- @Override public void init(ComponentRepository repo, LinkedHashMap<String, String> configuration) { ToolContext context = createToolContext(); Map<String, MetaProperty<?>> mapTarget = new HashMap<String, MetaProperty<?>>(context.metaBean().metaPropertyMap()); mapTarget.keySet().retainAll(this.metaBean().metaPropertyMap().keySet()); for (MetaProperty<?> mp : mapTarget.values()) { mp.set(context, property(mp.name()).get()); } context.setContextManager(repo); repo.registerInfrastructure(ToolContext.class, getClassifier(), context); }
@Override public MapBeanBuilder setString(MetaProperty<?> metaProperty, String value) { // no type information to perform a conversion // this approach allows meta-property from one MapBean to be used with another bean.put(metaProperty.name(), value); return this; }
public GetBeanPropertyFunction( final String functionName, final MetaProperty<?> property, final MetaParameter beanParameter) { List<MetaParameter> parameters = ImmutableList.of(beanParameter); _definition = new MetaFunction( null, functionName, parameters, new AbstractFunctionInvoker(parameters) { @Override protected Object invokeImpl(SessionContext sessionContext, Object[] parameters) throws AsynchronousExecution { return property.get((Bean) parameters[0]); } }); _definition.setDescription( "Gets the " + property.name() + " field from a " + property.declaringType().getSimpleName()); }
@Override public MapBeanBuilder set(MetaProperty<?> metaProperty, Object value) { // this approach allows meta-property from one bean to be used with another bean.put(metaProperty.name(), value); return this; }
@Override public Object get(MetaProperty<?> metaProperty) { // this approach allows meta-property from one bean to be used with another return bean.get(metaProperty.name()); }