Exemplo n.º 1
0
 // -------------------------------------------------------------------------
 @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);
 }
Exemplo n.º 2
0
 @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());
  }
Exemplo n.º 4
0
 @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;
 }
Exemplo n.º 5
0
 @Override
 public Object get(MetaProperty<?> metaProperty) {
   // this approach allows meta-property from one bean to be used with another
   return bean.get(metaProperty.name());
 }