Package org.apache.commons.jexl

Examples of org.apache.commons.jexl.JexlContext


     * @return boolean
     */
    public boolean matchGetFieldPointcut(final ClassMetaData classMetaData,
                                         final FieldMetaData fieldMetaData) {
        try {
            JexlContext jexlContext = JexlHelper.createContext();

            matchGetFieldPointcutPatterns(jexlContext, classMetaData, fieldMetaData);

            // evaluate the expression
            Boolean result = (Boolean)m_jexlExpr.evaluate(jexlContext);
View Full Code Here


     * @param classMetaData the class meta-data
     * @return boolean
     */
    public boolean matchThrowsPointcut(final ClassMetaData classMetaData) {
        try {
            JexlContext jexlContext = JexlHelper.createContext();

            matchThrowsPointcutPatterns(jexlContext, classMetaData);

            // evaluate the expression
            Boolean result = (Boolean)m_jexlExpr.evaluate(jexlContext);
View Full Code Here

     * @return boolean
     */
    public boolean matchThrowsPointcut(final ClassMetaData classMetaData,
                                       final MethodMetaData methodMetaData) {
        try {
            JexlContext jexlContext = JexlHelper.createContext();

            matchThrowsPointcutPatterns(jexlContext, classMetaData, methodMetaData);

            // evaluate the expression
            Boolean result = (Boolean)m_jexlExpr.evaluate(jexlContext);
View Full Code Here

     * @return boolean
     */
    public boolean matchCallerSidePointcut(final ClassMetaData classMetaData,
                                           final MethodMetaData methodMetaData) {
        try {
            JexlContext jexlContext = JexlHelper.createContext();

            matchCallerSidePointcutPatterns(jexlContext, classMetaData, methodMetaData);

            // evaluate the expression
            Boolean resultMethExpr = (Boolean)m_jexlExpr.evaluate(jexlContext);
View Full Code Here

     * @return boolean
     */
    public boolean matches(final ClassMetaData classMetaData,
                           final MethodMetaData methodMetaData) {
        try {
            JexlContext jexlContext = JexlHelper.createContext();

            matchPointcutPatterns(jexlContext, classMetaData, methodMetaData);

            // evaluate expression
            Boolean result = (Boolean)m_jexlExpr.evaluate(jexlContext);
View Full Code Here

        return "${" + expression.getExpression() + "}";
    }

    public Object evaluate(JellyContext context) {
        try {
            JexlContext jexlContext = new JellyJexlContext( context );
            if (log.isDebugEnabled()) {
                log.debug("Evaluating EL: " + expression.getExpression());
            }
            Object value = expression.evaluate(jexlContext);
View Full Code Here

    // Create an expression object
    String jexlExp = "e.message == 'hix'";
    Expression e = ExpressionFactory.createExpression(jexlExp);

    // Create a context and add data
    JexlContext jc = JexlHelper.createContext();
    jc.getVars().put("e", loggingEvent);

    // Now evaluate the expression, getting the result
    Object o = e.evaluate(jc);
    System.out.println("==" + o);
   
View Full Code Here

     {
         Parser parser = new Parser(new StringReader(";"));

         SimpleNode sn = parser.parse(new StringReader("foo = 1;"));

         JexlContext jc = JexlHelper.createContext();

         sn.interpret(jc);
     }
View Full Code Here

    public void testParse2()
        throws Exception
    {
        Parser parser = new Parser(new StringReader(";"));

        JexlContext jc = JexlHelper.createContext();

        SimpleNode sn = parser.parse(new StringReader("foo = \"bar\";"));
        sn.interpret(jc);
        sn = parser.parse(new StringReader("foo = 'bar';"));
        sn.interpret(jc);
View Full Code Here

            @SuppressWarnings("unchecked")
            public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException {
                if (method.getAnnotation(Callback.class) != null) {
                    try {
                        Expression e = ExpressionFactory.createExpression(method.getAnnotation(Callback.class).condition());
                        JexlContext jc = JexlHelper.createContext();
                        jc.getVars().put("this", bean);
                        Object r = e.evaluate(jc);
                        if (r instanceof Boolean == false) {
                            throw new RuntimeException("Expression did not returned a boolean value but: " + r);
                        }
                        Boolean oldVal = req.getCallbacks().get(method);
View Full Code Here

TOP

Related Classes of org.apache.commons.jexl.JexlContext

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.