Package org.codehaus.aspectwerkz.definition.expression

Examples of org.codehaus.aspectwerkz.definition.expression.ExpressionContext


        }
        return rhs;
    }

    public Object visit(NotNode node, Object data) {
        ExpressionContext ctx = (ExpressionContext)data;
        Boolean lhs = (Boolean)node.jjtGetChild(0).jjtAccept(this, data);
        if (lhs == null) {
            return Boolean.TRUE;//ignore the "NOT cflow(..)"
        }
        else if (lhs.booleanValue()) {
View Full Code Here


            return Boolean.TRUE;
        }
    }

    public Object visit(Identifier node, Object data) {
        ExpressionContext ctx = (ExpressionContext)data;
        String leafName = node.name;
        Expression expression = ctx.getNamespace().getExpression(leafName);
        if (expression != null) {
            if (PointcutType.isCflowTypeOnly(expression.getTypes())) {
                return null;//Boolean.TRUE;//match at TF time
            } else {
                //TODO WITHIN
                return new Boolean(expression.match(ctx.getClassMetaData(),
                        ctx.getMemberMetaData(), ctx.getExceptionType(), ctx.getPointcutType())
                );
            }
        }
        else {
            throw new RuntimeException("no such registered expression");
View Full Code Here

    public Object visit(FalseNode node, Object data) {
        return Boolean.FALSE;
    }

    public Object visit(Anonymous node, Object data) {
        ExpressionContext ctx = (ExpressionContext)data;
        String expr = node.name;

        if (expr.startsWith("cflow(")) {
            return null;//Boolean.TRUE;
        } else {
            Expression expression = null;
            ExpressionNamespace ns = ctx.getNamespace();
            if (expr.startsWith("execution(")) {
                expression = ns.createExecutionExpression(
                        expr.substring(10, expr.length()-1),
                        "",""
                );
            } else if (expr.startsWith("call(")) {
                expression = ns.createCallExpression(
                        expr.substring(5, expr.length()-1),
                        "",""
                );
            } else if (expr.startsWith("set(")) {
                expression = ns.createSetExpression(
                        expr.substring(4, expr.length()-1),
                        "",""
                );
            } else if (expr.startsWith("get(")) {
                expression = ns.createGetExpression(
                        expr.substring(4, expr.length()-1),
                        "",""
                );
            } else if (expr.startsWith("class(")) {
                expression = ns.createClassExpression(
                        expr.substring(6, expr.length()-1),
                        "",""
                );
            } else if (expr.startsWith("handler(")) {
                expression = ns.createHandlerExpression(
                        expr.substring(8, expr.length()-1),
                        "",""
                );
            } else if (expr.startsWith("attribute(")) {
                expression = ns.createAttributeExpression(
                        expr.substring(10, expr.length()-1),
                        ""
                );
            } else {
                throw new RuntimeException("unknown anonymous: "+expr);
            }
            if (expression.match(
                    ctx.getClassMetaData(), ctx.getMemberMetaData(), ctx.getExceptionType(), ctx.getPointcutType())) {
                return Boolean.TRUE;
            } else {
                return Boolean.FALSE;
            }
        }
View Full Code Here

        StringBuffer expr = new StringBuffer("NOT (").append(lhs.toString()).append(")");
        return expr;
    }

    public Object visit(Identifier node, Object data) {
        ExpressionContext ctx = (ExpressionContext)data;
        String leafName = node.name;
        Expression expression = ctx.getNamespace().getExpression(leafName);
        if (expression != null) {
            if (expression instanceof CflowExpression) {
                return new StringBuffer(leafName);
                //TODO how to support cflow(attribute(..)) ?
            }
            else if (expression instanceof LeafExpression) {
                if (expression.match(ctx.getClassMetaData(),
                        ctx.getMemberMetaData(), ctx.getExceptionType(), ctx.getPointcutType())) {
                    return TRUE;
                } else {
                    return FALSE;
                }
            }
View Full Code Here

        String expr = node.name;
        if (expr.startsWith("cflow(")) {
            return new StringBuffer(expr);
        } else {
            Expression expression = null;
            ExpressionContext ctx = (ExpressionContext)data;
            ExpressionNamespace ns = ctx.getNamespace();
            if (expr.startsWith("execution(")) {
                expression = ns.createExecutionExpression(
                        expr.substring(10, expr.length()-1),
                        "",""
                );
            } else if (expr.startsWith("call(")) {
                expression = ns.createCallExpression(
                        expr.substring(5, expr.length()-1),
                        "",""
                );
            } else if (expr.startsWith("set(")) {
                expression = ns.createSetExpression(
                        expr.substring(4, expr.length()-1),
                        "",""
                );
            } else if (expr.startsWith("get(")) {
                expression = ns.createGetExpression(
                        expr.substring(4, expr.length()-1),
                        "",""
                );
            } else if (expr.startsWith("class(")) {
                expression = ns.createClassExpression(
                        expr.substring(6, expr.length()-1),
                        "",""
                );
            } else if (expr.startsWith("handler(")) {
                expression = ns.createHandlerExpression(
                        expr.substring(8, expr.length()-1),
                        "",""
                );
            } else if (expr.startsWith("attribute(")) {
                expression = ns.createAttributeExpression(
                        expr.substring(10, expr.length()-1),
                        ""
                );
            } else {
                throw new RuntimeException("unknown anonymous: "+expr);
            }
            if (expression.match(
                    ctx.getClassMetaData(), ctx.getMemberMetaData(), ctx.getExceptionType(), ctx.getPointcutType())) {
                return TRUE;
            } else {
                return FALSE;
            }
        }
View Full Code Here

        Boolean rhs = (Boolean)node.jjtGetChild(1).jjtAccept(this, data);
        return rhs;
    }

    public Object visit(NotNode node, Object data) {
        ExpressionContext ctx = (ExpressionContext)data;
        Boolean lhs = (Boolean)node.jjtGetChild(0).jjtAccept(this, data);
        if (lhs.booleanValue()) {
            return Boolean.FALSE;
        }
        else {
View Full Code Here

            return Boolean.TRUE;
        }
    }

    public Object visit(Identifier node, Object data) {
        ExpressionContext ctx = (ExpressionContext)data;
        String leafName = node.name;
        Expression expression = ctx.getNamespace().getExpression(leafName);
        if (expression != null) {
            if (PointcutType.isCflowTypeOnly(expression.getTypes())) {
                return Boolean.TRUE;//match at TF time
            } else {
                //TODO WITHIN
                return new Boolean(expression.match(ctx.getClassMetaData(),
                        ctx.getMemberMetaData(), ctx.getExceptionType(), ctx.getPointcutType())
                );
            }
        }
        else {
            throw new RuntimeException("no such registered expression");
View Full Code Here

    public Object visit(FalseNode node, Object data) {
        return Boolean.FALSE;
    }

    public Object visit(Anonymous node, Object data) {
        ExpressionContext ctx = (ExpressionContext)data;
        String expr = node.name;

        if (expr.startsWith("cflow(")) {
            return Boolean.TRUE;
        } else {
            Expression expression = null;
            ExpressionNamespace ns = ctx.getNamespace();
            if (expr.startsWith("execution(")) {
                expression = ns.createExecutionExpression(
                        expr.substring(10, expr.length()-1),
                        "",""
                );
            } else if (expr.startsWith("call(")) {
                expression = ns.createCallExpression(
                        expr.substring(5, expr.length()-1),
                        "",""
                );
            } else if (expr.startsWith("set(")) {
                expression = ns.createSetExpression(
                        expr.substring(4, expr.length()-1),
                        "",""
                );
            } else if (expr.startsWith("get(")) {
                expression = ns.createGetExpression(
                        expr.substring(4, expr.length()-1),
                        "",""
                );
            } else if (expr.startsWith("class(")) {
                expression = ns.createClassExpression(
                        expr.substring(6, expr.length()-1),
                        "",""
                );
            } else if (expr.startsWith("handler(")) {
                expression = ns.createHandlerExpression(
                        expr.substring(8, expr.length()-1),
                        "",""
                );
            } else if (expr.startsWith("attribute(")) {
                expression = ns.createAttributeExpression(
                        expr.substring(10, expr.length()-1),
                        ""
                );
            } else {
                throw new RuntimeException("unknown anonymous: "+expr);
            }
            if (expression.match(
                    ctx.getClassMetaData(), ctx.getMemberMetaData(), ctx.getExceptionType(), ctx.getPointcutType())) {
                return Boolean.TRUE;
            } else {
                return Boolean.FALSE;
            }
        }
View Full Code Here

        // match(baz.p(..))(!baz.m(..) && baz.p(..)) => !TRUE && TRUE !! but should still early match !!
        return Boolean.TRUE;
    }

    public Object visit(Identifier node, Object data) {
        ExpressionContext ctx = (ExpressionContext)data;
        String leafName = node.name;
        Expression expression = ctx.getNamespace().getExpression(leafName);
        if (expression != null) {
            if (PointcutType.isCflowTypeOnly(expression.getTypes())) {
                return Boolean.TRUE;//match at TF time
            } else {
                //TODO WITHIN
                return new Boolean(expression.match(ctx.getClassMetaData(), ctx.getPointcutType()));
            }
        }
        else {
            throw new RuntimeException("no such registered expression");
        }
View Full Code Here

        String expr = node.name;
        if (expr.startsWith("cflow(")) {
            return Boolean.TRUE;
        } else {
            Expression expression = null;
            ExpressionContext ctx = (ExpressionContext)data;
            ExpressionNamespace ns = ctx.getNamespace();
            if (expr.startsWith("execution(")) {
                expression = ns.createExecutionExpression(
                        expr.substring(10, expr.length()-1),
                        "",""
                );
            } else if (expr.startsWith("call(")) {
                expression = ns.createCallExpression(
                        expr.substring(5, expr.length()-1),
                        "",""
                );
            } else if (expr.startsWith("set(")) {
                expression = ns.createSetExpression(
                        expr.substring(4, expr.length()-1),
                        "",""
                );
            } else if (expr.startsWith("get(")) {
                expression = ns.createGetExpression(
                        expr.substring(4, expr.length()-1),
                        "",""
                );
            } else if (expr.startsWith("class(")) {
                expression = ns.createClassExpression(
                        expr.substring(6, expr.length()-1),
                        "",""
                );
            } else if (expr.startsWith("handler(")) {
                expression = ns.createHandlerExpression(
                        expr.substring(8, expr.length()-1),
                        "",""
                );
            } else if (expr.startsWith("attribute(")) {
                expression = ns.createAttributeExpression(
                        expr.substring(10, expr.length()-1),
                        ""
                );
            } else {
                throw new RuntimeException("unknown anonymous: "+expr);
            }
            if (expression.match(ctx.getClassMetaData(), ctx.getPointcutType())) {
                return Boolean.TRUE;
            } else {
                return Boolean.FALSE;
            }
        }
View Full Code Here

TOP

Related Classes of org.codehaus.aspectwerkz.definition.expression.ExpressionContext

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.