org.mvel2.MVEL.setProperty()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(238)

本文整理了Java中org.mvel2.MVEL.setProperty()方法的一些代码示例,展示了MVEL.setProperty()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MVEL.setProperty()方法的具体详情如下:
包路径:org.mvel2.MVEL
类名称:MVEL
方法名:setProperty

MVEL.setProperty介绍

暂无

代码示例

代码示例来源:origin: com.google.sitebricks/sitebricks

public void write(String expr, Object bean, Object value) {
 //lets use mvel to store an expression
 MVEL.setProperty(bean, expr, value);
}

代码示例来源:origin: br.com.objectos/sitebricks

public void write(String expr, Object bean, Object value) {
 //lets use mvel to store an expression
 MVEL.setProperty(bean, expr, value);
}

代码示例来源:origin: br.com.objectos/sitebricks

public void write(String expr, Object bean, Object value) {
 //lets use mvel to store an expression
 MVEL.setProperty(bean, expr, value);
}

代码示例来源:origin: dhanji/sitebricks

public void write(String expr, Object bean, Object value) {
 //lets use mvel to store an expression
 MVEL.setProperty(bean, expr, value);
}

代码示例来源:origin: com.github.fosin/cdp-utils

/**
 * setProperty
 *
 * @param bean a {@link java.lang.Object} object.
 * @param nm a {@link java.lang.String} object.
 * @param v a {@link java.lang.Object} object.
 * @throws java.lang.Exception if any.
 */
public static void setProperty(Object bean, String nm, Object v) throws Exception {
  MVEL.setProperty(bean, nm, v);
}

代码示例来源:origin: dhanji/sitebricks

public void write(String expr, Object bean, Object value) {
 //lets use mvel to store an expression
 MVEL.setProperty(bean, expr, value);
}

代码示例来源:origin: com.google.sitebricks/sitebricks

public void write(String expr, Object bean, Object value) {
 //lets use mvel to store an expression
 MVEL.setProperty(bean, expr, value);
}

代码示例来源:origin: io.github.dheid/wings-integration

@Override
public void execute(MacroContext ctx) {
  Object value = resolveRhsReference();
  if (lhsIsVariableReference) {
    // step 1: store value in macro context...
    ctx.put(lhsReference, value);
    // step 2: try to write through into component
    try {
      MVEL.setProperty(ctx.getComponent(), lhsReference, value);
    } catch (Exception e) {
      // ignore...
    }
  } else if (lhsIsPropertyReference) {
    MVEL.setProperty(ctx, lhsReference, value); // XXX: not sure about this...
  } else {
    LOG.debug("Invalid set directive: \"" + instruction + '"');
  }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.mvel

public void eval(Object ctx, VariableResolverFactory vrf) {
    if (parm == null) {
      MVEL.eval(value, ctx, vrf);
    }
    else {
      MVEL.setProperty(ctx, parm, MVEL.eval(value, ctx, vrf));
    }
  }
}

代码示例来源:origin: org.mvel/mvel2

public void testJIRA103() {
 MvelContext mvelContext = new MvelContext();
 MVEL.setProperty(mvelContext,
   "regkeys",
   "s");
}

代码示例来源:origin: org.mvel/mvel2

public void testMapBindingSemantics() {
 Map<String, Object> outermap = new HashMap<String, Object>();
 Map<String, Object> innermap = new HashMap<String, Object>();
 innermap.put("test",
   "foo");
 outermap.put("innermap",
   innermap);
 setProperty(outermap,
   "innermap['test']",
   "bar");
 assertEquals("bar",
   testCompiledSimple("innermap['test']",
     outermap,
     null));
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.mvel

public Object getReducedValue(Object ctx, Object thisValue, VariableResolverFactory factory) {
  checkNameSafety(name);
  if (col) {
    MVEL.setProperty(factory.getIndexedVariableResolver(register).getValue(), new String(index), ctx = MVEL.eval(stmt, ctx, factory));
  }
  else {
    factory.createIndexedVariable(register, name, ctx = MVEL.eval(stmt, ctx, factory));
  }
  return ctx;
}

代码示例来源:origin: org.mvel/mvel2

public Object getReducedValue(Object ctx, Object thisValue, VariableResolverFactory factory) {
 checkNameSafety(name);
 if (col) {
  MVEL.setProperty(factory.getIndexedVariableResolver(register).getValue(), new String(index), ctx = MVEL.eval(stmt, ctx, factory));
 }
 else {
  factory.createIndexedVariable(register, name, ctx = MVEL.eval(stmt, ctx, factory));
 }
 return ctx;
}

代码示例来源:origin: io.virtdata/virtdata-lib-realer

public Object getReducedValue(Object ctx, Object thisValue, VariableResolverFactory factory) {
 checkNameSafety(name);
 if (col) {
  MVEL.setProperty(factory.getIndexedVariableResolver(register).getValue(), new String(index), ctx = MVEL.eval(stmt, ctx, factory));
 }
 else {
  factory.createIndexedVariable(register, name, ctx = MVEL.eval(stmt, ctx, factory));
 }
 return ctx;
}

代码示例来源:origin: org.mvel/mvel2

public static void main(String[] args) {
  Foo foo = new Foo("Gorkum");

  Map vars = new HashMap();
  vars.put("foo", foo);

  final ParserContext ctx = ParserContext.create()
    .withInput("foo", Foo.class);

  final String expression = "foo";

  MVEL.setProperty(foo, "name", "mike");

  System.out.println(foo.getName());

 }
}

代码示例来源:origin: org.mvel/mvel2

public void testBindingCoercion() {
 List list = new LinkedList();
 list.add("Apple");
 list.add("Peach");
 list.add("Icing");
 Cake cake = new Cake();
 MVEL.setProperty(cake, "ingredients", list);
 assertTrue(cake.getIngredients().contains("Apple"));
 assertTrue(cake.getIngredients().contains("Peach"));
 assertTrue(cake.getIngredients().contains("Icing"));
}

代码示例来源:origin: org.mvel/mvel2

public void testPropertyHandlerSetting() {
 MVEL.COMPILER_OPT_ALLOW_OVERRIDE_ALL_PROPHANDLING = true;
 PropertyHandlerFactory.registerPropertyHandler(WorkObject.class, new WebPropertyHandler());
 Map vars = new HashMap();
 WorkObject wo = new WorkObject();
 vars.put("wobj", wo);
 MVEL.setProperty(vars, "wobj.foo", "foobie");
 assertEquals("foobie", wo.getFieldValue("foo"));
}

代码示例来源:origin: org.mvel/mvel2

public void testRandomSomething() {
 Foo foo = new Foo();
 foo.setName("foo1");
 Foo foo2 = new Foo();
 foo2.setName("foo2");
 MVEL.setProperty(foo, "name", 5);
 Serializable s = MVEL.compileExpression("name.toUpperCase()", ParserContext.create().stronglyTyped().withInput("name", String.class));
 Object _return = executeExpression(s, foo);
 System.out.println("returned value: " + String.valueOf(_return));
 _return = executeExpression(s, foo2);
 System.out.println("returned value: " + String.valueOf(_return));
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.mvel

MVEL.setProperty(ctx, parm, MVEL.eval(new String(createShortFormOperativeAssignment(new StringAppender(nestParm).append(".").append(parm).toString(),
        subset(block, start, end - start), oper)), ctx, factory));
MVEL.setProperty(ctx, parm, MVEL.eval(
    new String(createShortFormOperativeAssignment(new StringAppender(nestParm).append(".").append(parm).toString(),
        subset(block, start, end - start), oper)), ctx, factory));

代码示例来源:origin: org.mvel/mvel2

public void testSetCoercion() {
 Serializable s = compileSetExpression("name");
 Foo foo = new Foo();
 executeSetExpression(s,
     foo,
     12);
 assertEquals("12",
     foo.getName());
 foo = new Foo();
 setProperty(foo,
     "name",
     12);
 assertEquals("12",
     foo.getName());
}

相关文章