Package org.codehaus.janino

Examples of org.codehaus.janino.ExpressionEvaluator.evaluate()


        new String[] { "c", "d" }, // parameterNames
        new Class[] { int.class, int.class } // parameterTypes
    );

    // Evaluate it with varying parameter values; very fast.
    return  (Integer) ee.evaluate(new Object[] { // parameterValues
        new Integer(10), new Integer(11), });
  }
}
View Full Code Here


   
    Logger logger = lc.getLogger(JaninoTest.class);
    LoggingEvent loggingEvent = new LoggingEvent("toto", logger, Level.INFO, "hi", null);
    parameterValues[0] = loggingEvent;
   
    Object res = ee.evaluate(parameterValues);

    // Print expression result.
    System.out.println("Result = " + DemoBase.toString(res));
    System.out.println("Type = " + res.getClass().getName());
    loop(ee, parameterValues);
View Full Code Here

   
    expression = "import ch.qos.logback.classic.Level; (e.getMarker() != null) && (e.getMarker().contains(\"yo\"))";
    ee = new ExpressionEvaluator(expression,
        optionalExpressionType, parameterNames, parameterTypes,
        thrownExceptions, null);
    res = ee.evaluate(parameterValues);

    // Print expression result.
    System.out.println("Result = " + DemoBase.toString(res));
    System.out.println("Type = " + res.getClass().getName());
    loop(ee, parameterValues);
View Full Code Here

        ExpressionEvaluator expressionEvaluator = new ExpressionEvaluator(
                "config.getServletContext().getServletRegistration(config.getServletName()).getMappings()",
                Collection.class,
                new String[]{"config"},
                new Class[]{ServletConfig.class});
        return (Collection<String>) expressionEvaluator.evaluate(new Object[]{config});
    }

    @Override
    public void destroy() {
        super.destroy();
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.