FileDocCategorySizeDatePackage
JexlExample.javaAPI DocExample2264Wed May 18 09:39:02 BST 2005com.discursive.jccook.template.jexl

JexlExample

public class JexlExample extends Object
Include a table of the Values in DateFormatUtils

Fields Summary
private static Logger
logger
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] pArgs)

     
        LogInit.init();
    
        JexlExample example = new JexlExample();
        example.testSimpleTemplate();
    
public voidtestSimpleTemplate()


        long[] numbers = {
            1, 3, 4, 6, 8, 9
        };
        String[] strings = {
            "Hello", "Goodbye"
        };
        Email email = new Email();

        //Expression e = ExpressionFactory.createExpression("strings[1].length() < 9");
        Expression e =
            ExpressionFactory.createExpression("email.test == 'TEST'");

        /*
         *  create a context and add data
         */
        JexlContext jc = JexlHelper.createContext();
        jc.getVars().put("numbers", numbers);
        jc.getVars().put("strings", strings);
        jc.getVars().put("email", email);

        Object o = e.evaluate(jc);
        logger.debug("result: " + o.getClass() + ", " + o);