Package cambridge.janino

Source Code of cambridge.janino.JaninoExpressionLanguage

package cambridge.janino;


import cambridge.ExpressionLanguage;
import cambridge.ExpressionParsingException;
import cambridge.Expressions;
import cambridge.model.Expression;
import cambridge.parser.expressions.MapExpressionContext;
import cambridge.runtime.ExpressionContext;

import java.util.Locale;

/**
* @author Tom Carchrae
*
* See http://docs.codehaus.org/display/JANINO/Home for more about Janino and its limitations
*
*/
public class JaninoExpressionLanguage implements ExpressionLanguage {
 
    public static void register() {
        Expressions.registerExpressionLanguage("janino", JaninoExpressionLanguage.class);
    }

    public Expression parse(String expressionString, int line, int column) throws ExpressionParsingException {
        return new JaninoExpression(expressionString, line, column);
    }

    public String wrapExpressionAsList(String expr) {
      //TODO: Check this.  Might require this to be { } instead.  Not clear
      System.err.println("Check wrapExpressionAsList: " + expr);
        return "[" + expr + "]";
    }

    @Override
    public ExpressionContext createNewContext(Locale locale)
    {
        return new MapExpressionContext(locale);
    }

    @Override
    public ExpressionContext createNewContext()
    {
        return new MapExpressionContext();
    }
}
TOP

Related Classes of cambridge.janino.JaninoExpressionLanguage

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.