Package org.mvel2.integration.impl

Examples of org.mvel2.integration.impl.MapVariableResolverFactory


        throw new TemplateRuntimeError("cannot iterate object type: " + o.getClass().getName());
      }
    }

    Map<String, Object> locals = new HashMap<String, Object>();
    MapVariableResolverFactory localFactory = new MapVariableResolverFactory(locals, factory);

    int iterate = iters.length;

    while (true) {
      for (int i = 0; i < iters.length; i++) {
View Full Code Here


  public void testThisReferenceMapVirtualObjects() {
    Map<String, String> map = new HashMap<String, String>();
    map.put("foo",
        "bar");

    VariableResolverFactory factory = new MapVariableResolverFactory(new HashMap<String, Object>());
    factory.createVariable("this", map);

    assertEquals(true,
        eval("this.foo == 'bar'", map, factory));
  }
View Full Code Here

  public void testThisReferenceMapVirtualObjects1() {
    // Create our root Map object
    Map<String, String> map = new HashMap<String, String>();
    map.put("foo", "bar");

    VariableResolverFactory factory = new MapVariableResolverFactory(new HashMap<String, Object>());
    factory.createVariable("this", map);

    OptimizerFactory.setDefaultOptimizer("reflective");

    // Run test
    assertEquals(true,
View Full Code Here

    // Create our root Map object
    Map<String, String> map = new HashMap<String, String>();
    map.put("foo",
        "bar");

    VariableResolverFactory factory = new MapVariableResolverFactory(new HashMap<String, Object>());
    factory.createVariable("this",
        map);

    // I think we can all figure this one out.

    if (!Boolean.getBoolean("mvel2.disable.jit")) OptimizerFactory.setDefaultOptimizer("ASM");
View Full Code Here

//                        mvf));
//    }


  public void testCheeseConstructor() {
    MapVariableResolverFactory mvf = new MapVariableResolverFactory(createTestMap());
    ClassImportResolverFactory classes = new ClassImportResolverFactory(null, null, false);
    classes.addClass(Cheese.class);

    ResolverTools.appendFactory(mvf,
        classes);
View Full Code Here

    CompiledExpression expr = compiler.compile();

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

    Object r = ((ExecutableStatement) expr).getValue(null, new MapVariableResolverFactory(vars));
    assertEquals(new Long(2), r);
  }
View Full Code Here

    Object compiled = MVEL.compileExpression(
        "outer.getInner().getValue()", context);

    Map<String, Object> vars = new HashMap<String, Object>();
    vars.put("outer", new Outer());
    VariableResolverFactory varsResolver = new MapVariableResolverFactory(vars);

    assertEquals(2, executeExpression(compiled, varsResolver));
  }
View Full Code Here

    Map<String, Object> vars = new HashMap<String, Object>();
    vars.put("obj", new Ship());

    VariableResolverFactory varsResolver
        = new MapVariableResolverFactory(vars);

    System.out.println(
        executeExpression(compiled, varsResolver));
  }
View Full Code Here

  MVELInterpretedRuntime(char[] expression, Object ctx, Map<String, Object> variables) {
    this.expr = expression;
    this.length = expr.length;
    this.ctx = ctx;
    this.variableFactory = new MapVariableResolverFactory(variables);
  }
View Full Code Here

    }
  }

  public Object getReducedValueAccelerated(Object ctx, Object thisValue, VariableResolverFactory factory) {
    if ((Boolean) condition.getValue(ctx, thisValue, factory)) {
      return nestedStatement.getValue(ctx, thisValue, idxAlloc ? factory : new MapVariableResolverFactory(new HashMap(0), factory));
    }
    else if (elseIf != null) {
      return elseIf.getReducedValueAccelerated(ctx, thisValue, idxAlloc ? factory : new MapVariableResolverFactory(new HashMap(0), factory));
    }
    else if (elseBlock != null) {
      return elseBlock.getValue(ctx, thisValue, idxAlloc ? factory : new MapVariableResolverFactory(new HashMap(0), factory));
    }
    else {
      return null;
    }
  }
View Full Code Here

TOP

Related Classes of org.mvel2.integration.impl.MapVariableResolverFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.