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

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

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

MVEL.compileSetExpression介绍

暂无

代码示例

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

public ParmValuePair(String parameter, ExecutableStatement statement, Class ingressType, ParserContext pCtx) {
  if (parameter != null && parameter.length() != 0) {
    this.setExpression = MVEL.compileSetExpression(parameter,
        ingressType != null ? getReturnType(ingressType, parameter, pCtx) : Object.class
        , pCtx);
  }
  this.statement = statement;
}

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

public ExecutablePairs(String parameter, ExecutableStatement statement, Class ingressType, ParserContext pCtx) {
 if (parameter != null && parameter.length() != 0) {
  this.setExpression = MVEL.compileSetExpression(parameter,
    ingressType != null ? getReturnType(ingressType, parameter, pCtx) : Object.class, pCtx);
 }
 this.statement = statement;
}

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

public ParmValuePair(String parameter, ExecutableStatement statement, Class ingressType, ParserContext pCtx) {
 if (parameter != null && parameter.length() != 0) {
  this.setExpression = MVEL.compileSetExpression(parameter,
    ingressType != null ? getReturnType(ingressType, parameter, pCtx) : Object.class
    , pCtx);
 }
 this.statement = statement;
}

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

public ExecutablePairs(String parameter, ExecutableStatement statement, Class ingressType, ParserContext pCtx) {
 if (parameter != null && parameter.length() != 0) {
  this.setExpression = MVEL.compileSetExpression(parameter,
    ingressType != null ? getReturnType(ingressType, parameter, pCtx) : Object.class, pCtx);
 }
 this.statement = statement;
}

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

public ParmValuePair(String parameter, ExecutableStatement statement, Class ingressType, ParserContext pCtx) {
 if (parameter != null && parameter.length() != 0) {
  this.setExpression = MVEL.compileSetExpression(parameter,
    ingressType != null ? getReturnType(ingressType, parameter, pCtx) : Object.class
    , pCtx);
 }
 this.statement = statement;
}

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

public ExecutablePairs(String parameter, ExecutableStatement statement, Class ingressType, ParserContext pCtx) {
  if (parameter != null && parameter.length() != 0) {
    this.setExpression = MVEL.compileSetExpression(parameter,
        ingressType != null ? getReturnType(ingressType, parameter, pCtx) : Object.class
        , getCurrentThreadParserContext());
  }
  this.statement = statement;
}

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

public Object getReducedValueAccelerated(Object ctx, Object thisValue, VariableResolverFactory factory) {
 if (statement == null) {
  statement = (ExecutableStatement) subCompileExpression(expr, this.start, this.offset, pCtx);
  acc = (CompiledAccExpression) compileSetExpression(property.toCharArray(), statement.getKnownEgressType(), pCtx);
 }
 acc.setValue(ctx, thisValue, factory, ctx = statement.getValue(ctx, thisValue, factory));
 return ctx;
}

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

public Object getReducedValueAccelerated(Object ctx, Object thisValue, VariableResolverFactory factory) {
 if (statement == null) {
  statement = (ExecutableStatement) subCompileExpression(expr, this.start, this.offset, pCtx);
  acc = (CompiledAccExpression) compileSetExpression(property.toCharArray(), statement.getKnownEgressType(), pCtx);
 }
 acc.setValue(ctx, thisValue, factory, ctx = statement.getValue(ctx, thisValue, factory));
 return ctx;
}

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

public Object getReducedValueAccelerated(Object ctx, Object thisValue, VariableResolverFactory factory) {
  if (statement == null) {
    statement = (ExecutableStatement) subCompileExpression(stmt);
    acc = (CompiledAccExpression) compileSetExpression(property.toCharArray(), statement.getKnownEgressType(),
        getCurrentThreadParserContext());
  }
  acc.setValue(ctx, thisValue, factory, ctx = statement.getValue(ctx, thisValue, factory));
  return ctx;
}

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

public void testBindListToArray() {
 Map<String, Object> vars = createTestMap();
 ArrayList<String> list = new ArrayList<String>();
 list.add("a");
 list.add("b");
 list.add("c");
 OptimizerFactory.setDefaultOptimizer("reflective");
 Serializable s = MVEL.compileSetExpression("foo.charArray");
 MVEL.executeSetExpression(s, vars, list);
 assertEquals(((Foo) vars.get("foo")).getCharArray().length, 3);
}

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

public void testSetExpressions1() {
 Map<String, Object> myMap = new HashMap<String, Object>();
 final Serializable fooExpr = compileSetExpression("foo");
 executeSetExpression(fooExpr,
   myMap,
   "blah");
 assertEquals("blah",
   myMap.get("foo"));
 executeSetExpression(fooExpr,
   myMap,
   "baz");
 assertEquals("baz",
   myMap.get("foo"));
}

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

public Object getReducedValueAccelerated(Object ctx, Object thisValue, VariableResolverFactory factory) {
  if (accExpr == null) {
    accExpr = (CompiledAccExpression) compileSetExpression(indexTarget);
  }
  if (col) {
    return accExpr.setValue(ctx, thisValue, factory, statement.getValue(ctx, thisValue, factory));
  }
  else if (statement != null) {
    return factory.createVariable(varName, statement.getValue(ctx, thisValue, factory)).getValue();
  }
  else {
    factory.createVariable(varName, null);
    return null;
  }
}

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

public void testSetExpressions2() {
 Foo foo = new Foo();
 Collection col = new ArrayList();
 final Serializable fooExpr = compileSetExpression("collectionTest");
 executeSetExpression(fooExpr,
   foo,
   col);
 assertEquals(col,
   foo.getCollectionTest());
}

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

public void testBindingNullToPrimitiveTypes4() {
 Map<String, Object> vars = createTestMap();
 ((Foo) vars.get("foo")).charTestFld = 'a';
 OptimizerFactory.setDefaultOptimizer("reflective");
 Serializable s = MVEL.compileSetExpression("foo.charTestFld");
 MVEL.executeSetExpression(s, vars, null);
 assertEquals(((Foo) vars.get("foo")).charTestFld, 0);
 OptimizerFactory.setDefaultOptimizer("ASM");
 s = MVEL.compileSetExpression("foo.charTestFld");
 MVEL.executeSetExpression(s, vars, null);
 assertEquals(((Foo) vars.get("foo")).charTestFld, 0);
 MVEL.executeSetExpression(s, vars, null);
 assertEquals(((Foo) vars.get("foo")).charTestFld, 0);
}

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

public void testListPropertyHandler2() {
 MVEL.COMPILER_OPT_ALLOW_OVERRIDE_ALL_PROPHANDLING = true;
 Serializable s = MVEL.compileSetExpression("list[0]");
 Base b;
 MVEL.executeSetExpression(s, new Base(), "hey you");
 MVEL.executeSetExpression(s, b = new Base(), "hey you");
 assertEquals("set", b.list.get(0));
}

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

public void testSetterViaMapNotation() {
 TestClass tc = new TestClass();
 tc.getExtra().put("test", "value");
 ParserContext ctx = new ParserContext();
 ctx.withInput("this", TestClass.class);
 ctx.setStrongTyping(true);
 String expression = "extra[\"test\"]";
 Serializable compiled = MVEL.compileSetExpression(expression, tc.getClass(), ctx);
 MVEL.executeSetExpression(compiled, tc, "value3");
 assertEquals("value3", tc.getExtra().get("test"));
}

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

public void testBindingNullToPrimitiveTypes3() {
 Map<String, Object> vars = createTestMap();
 ((Foo) vars.get("foo")).setCharTest('a');
 OptimizerFactory.setDefaultOptimizer("reflective");
 Serializable s = MVEL.compileSetExpression("foo.charTest");
 MVEL.executeSetExpression(s, vars, null);
 assertEquals(((Foo) vars.get("foo")).getCharTest(), 0);
 OptimizerFactory.setDefaultOptimizer("ASM");
 s = MVEL.compileSetExpression("foo.charTest");
 MVEL.executeSetExpression(s, vars, null);
 assertEquals(((Foo) vars.get("foo")).getCharTest(), 0);
 MVEL.executeSetExpression(s, vars, null);
 assertEquals(((Foo) vars.get("foo")).getCharTest(), 0);
}

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

public void testSetterViaDotNotation() {
 TestClass tc = new TestClass();
 tc.getExtra().put("test", "value");
 ParserContext ctx = new ParserContext();
 ctx.setStrongTyping(true);
 String expression = "extra.test";
 Serializable compiled = MVEL.compileSetExpression(expression, ctx);
 MVEL.executeSetExpression(compiled, tc, "value2");
 assertEquals("value2", tc.getExtra().get("test"));
}

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

public void testBindingNullToPrimitiveTypes2() {
 Map<String, Object> vars = createTestMap();
 ((Foo) vars.get("foo")).setCountTest(10);
 OptimizerFactory.setDefaultOptimizer("reflective");
 Serializable s = MVEL.compileSetExpression("foo.boolTest");
 MVEL.executeSetExpression(s, vars, null);
 assertFalse(((Foo) vars.get("foo")).isBoolTest());
 OptimizerFactory.setDefaultOptimizer("ASM");
 s = MVEL.compileSetExpression("foo.boolTest");
 MVEL.executeSetExpression(s, vars, null);
 assertFalse(((Foo) vars.get("foo")).isBoolTest());
 MVEL.executeSetExpression(s, vars, null);
 assertFalse(((Foo) vars.get("foo")).isBoolTest());
}

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

public void testListPropertyHandler3() {
 MVEL.COMPILER_OPT_ALLOW_OVERRIDE_ALL_PROPHANDLING = true;
 OptimizerFactory.setDefaultOptimizer("ASM");
 Serializable s = MVEL.compileSetExpression("list[0]");
 Base b;
 MVEL.executeSetExpression(s, new Base(), "hey you");
 MVEL.executeSetExpression(s, b = new Base(), "hey you");
 assertEquals("set", b.list.get(0));
}

相关文章