Examples of MapVariableResolverFactory


Examples of org.mvel2.integration.impl.MapVariableResolverFactory

                 Boolean.TRUE );

        TemplateRegistry registry = getInvokerTemplateRegistry();
        Object method = TemplateRuntime.execute( registry.getNamedTemplate( "accumulateInvoker" ),
                                                 null,
                                                 new MapVariableResolverFactory( map ),
                                                 registry );

        //System.out.println( method );
    }
View Full Code Here

Examples of org.mvel2.integration.impl.MapVariableResolverFactory

        context.put( "session",
                     session );

        return (String) TemplateRuntime.execute( REPORT_REGISTRY.getNamedTemplate( ruleTemplate ),
                                                 null,
                                                 new MapVariableResolverFactory( context ),
                                                 REPORT_REGISTRY );
    }
View Full Code Here

Examples of org.mvel2.integration.impl.MapVariableResolverFactory

    @Override
    public Object run(Map<String, Object> variables) {
        if (variables == null) {
            variables = new HashMap<String, Object>();
        }
        VariableResolverFactory factory = new MapVariableResolverFactory(variables, _propertyResolverFactory);
        return isCompiled() ? MVEL.executeExpression(_compiled, factory) : MVEL.eval(_expression, factory);
    }
View Full Code Here

Examples of org.mvel2.integration.impl.MapVariableResolverFactory

        (((Foo) ((Map) executeExpression(s)).get("foo")).getBar().getName()));
  }

  public void testSataticClassImportViaFactoryAndWithModification() {
    OptimizerFactory.setDefaultOptimizer("ASM");
    MapVariableResolverFactory mvf = new MapVariableResolverFactory(createTestMap());
    ClassImportResolverFactory classes = new ClassImportResolverFactory(null, null, false);
    classes.addClass(Person.class);

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

Examples of org.mvel2.integration.impl.MapVariableResolverFactory

  }

  public void testMVEL225() {
    Serializable compileExpression = MVEL.compileExpression(
        "def f() { int a=1;a++;return a; }; f();");
    MapVariableResolverFactory factory = new MapVariableResolverFactory(new HashMap<String, Object>());
    assertEquals(2, MVEL.executeExpression(compileExpression, factory));
  }
View Full Code Here

Examples of org.mvel2.integration.impl.MapVariableResolverFactory

            "&& x__0 == 'boob';"));
  }


  public void testFunctionReuse() {
    VariableResolverFactory functionFactory = new MapVariableResolverFactory();
    MVEL.eval("def foo() { \"foo\"; }; def bar() { \"bar\" };", functionFactory);

    VariableResolverFactory myVarFactory = new MapVariableResolverFactory();
    myVarFactory.setNextFactory(functionFactory);

    Serializable s = MVEL.compileExpression("foo() + bar();");

    assertEquals("foobar", MVEL.executeExpression(s, myVarFactory));
  }
View Full Code Here

Examples of org.mvel2.integration.impl.MapVariableResolverFactory

    }
  }

  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

Examples of org.mvel2.integration.impl.MapVariableResolverFactory

    }
  }

  public Object getReducedValue(Object ctx, Object thisValue, VariableResolverFactory factory) {
    if ((Boolean) eval(expr, start, offset, ctx, factory)) {
      return eval(expr, blockStart, blockOffset, ctx, new MapVariableResolverFactory(new HashMap(0), factory));
    }
    else if (elseIf != null) {
      return elseIf.getReducedValue(ctx, thisValue, new MapVariableResolverFactory(new HashMap(0), factory));
    }
    else if (elseBlock != null) {
      return elseBlock.getValue(ctx, thisValue, new MapVariableResolverFactory(new HashMap(0), factory));
    }
    else {
      return null;
    }
  }
View Full Code Here

Examples of org.mvel2.integration.impl.MapVariableResolverFactory

    }

    try {
      Serializable xx = serializationTest(compiledD);
      AbstractParser.resetParserContext();
      eighth = executeExpression(xx, new Base(), new MapVariableResolverFactory(createTestMap()));
    }
    catch (Exception e) {
      if (failErrors == null) failErrors = new StringAppender();
      failErrors.append("\nEIGHTH TEST (Serializability): { " + ex + " }: EXCEPTION REPORT: \n\n");
View Full Code Here

Examples of org.mvel2.integration.impl.MapVariableResolverFactory

      }
    };

    MVELRuntime.setThreadDebugger(testDebugger);

    assertEquals(10, MVEL.executeDebugger(compiled, null, new MapVariableResolverFactory(createTestMap())));
    assertTrue("did not break at line 7", breaked.contains(7));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.