Package org.mvel2.integration.impl

Examples of org.mvel2.integration.impl.MapVariableResolverFactory


        assertTrue(false);
    }

    public void testTemplateFile() {
        String s = (String) TemplateRuntime.eval(new File("src/test/java/org/mvel2/tests/templates/templateIfTest.mv"),
                base, new MapVariableResolverFactory(map), null);

        System.out.println(s);

    }
View Full Code Here


        CompiledTemplate compiledTemplate = TemplateCompiler.compileTemplate(template);

        Map<String, Object> model = new HashMap<String, Object>();
        model.put("foo", foo);

        System.out.println(TemplateRuntime.execute(compiledTemplate, new ParserContext(), new MapVariableResolverFactory(model)));
    }
View Full Code Here

                                                                Collections.EMPTY_LIST ) ) ) );


        String result = (String) TemplateRuntime.execute( reportRegistry.getNamedTemplate( "drl" ),
                                                          null,
                                                          new MapVariableResolverFactory( context ),
                                                          reportRegistry );

        assertEquals("OR AND AND OR", result);
    }
View Full Code Here

    this.function = function;
  }

  @Override
  public Object getReducedValue(Object ctx, Object thisValue, VariableResolverFactory factory) {
    final MapVariableResolverFactory resolverFactory = new MapVariableResolverFactory(new HashMap<String, Object>(), factory);
    function.getCompiledBlock().getValue(ctx, thisValue, resolverFactory);
    return new PrototypalFunctionInstance(function, resolverFactory);
  }
View Full Code Here

  public void testQuickSort() throws IOException {
    Serializable s = MVEL.compileExpression(new String(ParseTools.loadFromFile(new File("samples/scripts/fquicksort.mvel"))));

    HashMap map = new HashMap();
    MapVariableResolverFactory mvrf = new MapVariableResolverFactory(map);

    for (int i = 0; i < 1000000; i++) {
      MVEL.executeExpression(s, mvrf);
      mvrf.clear();
    }

//        for (int x = 0; x < 4; x++) {
//            Serializable s = MVEL.compileSetExpression("tak.bar.name");
//            long time = System.currentTimeMillis();
View Full Code Here

      pCtx.popVariableScope();
    }
  }

  public Object getReducedValueAccelerated(Object ctx, Object thisValue, VariableResolverFactory factory) {
    VariableResolverFactory lc = new MapVariableResolverFactory(new HashMap(0), factory);

    do {
      compiledBlock.getValue(ctx, thisValue, lc);
    }
    while (!(Boolean) condition.getValue(ctx, thisValue, lc));
View Full Code Here

    return null;
  }

  public Object getReducedValue(Object ctx, Object thisValue, VariableResolverFactory factory) {
    VariableResolverFactory lc = new MapVariableResolverFactory(new HashMap(0), factory);

    do {
      compiledBlock.getValue(ctx, thisValue, lc);
    }
    while (!(Boolean) condition.getValue(ctx, thisValue, lc));
View Full Code Here

    pCtx.addVariable(name, Function.class);
  }

  public Object getReducedValueAccelerated(Object ctx, Object thisValue, VariableResolverFactory factory) {
    PrototypalFunctionInstance instance = new PrototypalFunctionInstance(this, new MapVariableResolverFactory());
    if (name != null) {
      if (!factory.isIndexedFactory() && factory.isResolveable(name))
        throw new CompileException("duplicate function: " + name, expr, start);

      factory.createVariable(name, instance);
View Full Code Here

    }
    return instance;
  }

  public Object getReducedValue(Object ctx, Object thisValue, VariableResolverFactory factory) {
    PrototypalFunctionInstance instance = new PrototypalFunctionInstance(this, new MapVariableResolverFactory());
    if (name != null) {
      if (!factory.isIndexedFactory() && factory.isResolveable(name))
        throw new CompileException("duplicate function: " + name, expr, start);
      factory.createVariable(name, instance);
    }
View Full Code Here

        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

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.