Package org.codehaus.aspectwerkz.expression.ast

Examples of org.codehaus.aspectwerkz.expression.ast.Node


        ReflectionInfo info = context.getWithinReflectionInfo();
        ClassInfo classInfo = info instanceof MemberInfo
        ? ((MemberInfo) info).getDeclaringType()
        : (ClassInfo) info;
       
        Node patternNode = node.jjtGetChild(node.jjtGetNumChildren() - 1);
        boolean hasPatternNode = !(patternNode instanceof ASTAttribute);

        MethodInfo[] methodInfos = classInfo.getMethods();
        for (int i = 0; i < methodInfos.length; i++) {
            if (hasPatternNode) {
                if(Boolean.FALSE.equals(patternNode.jjtAccept(this, methodInfos[i]))) {
                    continue;
                }
            }

            boolean matchAnnotations = visitAttributes(node, methodInfos[i]);
            if (matchAnnotations) {
                return Boolean.TRUE;
            }
    }

        ConstructorInfo[] constructorInfos = classInfo.getConstructors();
        for (int i = 0; i < constructorInfos.length; i++) {
            if (hasPatternNode) {
                if(Boolean.FALSE.equals(patternNode.jjtAccept(this, constructorInfos[i]))) {
                    continue;
                }
            }

            boolean matchAnnotations = visitAttributes(node, constructorInfos[i]);
View Full Code Here


        // for execution() pointcut, this is equals to CALLEE info
        ReflectionInfo info = context.getWithinReflectionInfo();
        ClassInfo classInfo = (info instanceof MemberInfo) ?
                              ((MemberInfo) info).getDeclaringType() : (ClassInfo) info;

        Node patternNode = node.jjtGetChild(node.jjtGetNumChildren() - 1);
        boolean hasPatternNode = !(patternNode instanceof ASTAttribute);

        FieldInfo[] fieldInfos = classInfo.getFields();
        for (int i = 0; i < fieldInfos.length; i++) {
            if (hasPatternNode) {
                if (Boolean.FALSE.equals(patternNode.jjtAccept(this, fieldInfos[i]))) {
                    continue;
                }
            }

          boolean matchAnnotations = visitAttributes(node, fieldInfos[i]);
View Full Code Here

    protected boolean visitAttributes(SimpleNode node, ReflectionInfo refInfo) {
        int nrChildren = node.jjtGetNumChildren();
        if (nrChildren != 0) {
            for (int i = 0; i < nrChildren; i++) {
                Node child = node.jjtGetChild(i);
                if (child instanceof ASTAttribute) {
                    List annotations = refInfo.getAnnotations();
                    if (Boolean.TRUE.equals(child.jjtAccept(this, annotations))) {
                        continue;
                    } else {
                        return false;
                    }
                }
View Full Code Here

    protected boolean visitModifiers(SimpleNode node, ReflectionInfo refInfo) {
        int nrChildren = node.jjtGetNumChildren();
        if (nrChildren != 0) {
            for (int i = 0; i < nrChildren; i++) {
                Node child = node.jjtGetChild(i);
                if (child instanceof ASTModifier) {
                    if (Boolean.TRUE.equals(child.jjtAccept(this, refInfo))) {
                        continue;
                    } else {
                        return false;
                    }
                }
View Full Code Here

        }

        // collect the parameter nodes
        List parameterNodes = new ArrayList();
        for (int i = 0; i < nrChildren; i++) {
            Node child = node.jjtGetChild(i);
            if (child instanceof ASTParameter) {
                parameterNodes.add(child);
            }
        }
View Full Code Here

     *        the expression subtree, <CODE>Boolean.FALSE</CODE> otherwise.
     */
    protected Object visitAnnotatedNode(SimpleNode node,
                      ReflectionInfo reflectInfo) {
        // In an annotated subtree, only the last child node may represent the pattern
        Node patternNode = node.jjtGetChild(node.jjtGetNumChildren() - 1);
        if (!(patternNode instanceof ASTAttribute)) {
            if (Boolean.FALSE.equals((Boolean)patternNode.jjtAccept(this, reflectInfo))) {
                return Boolean.FALSE;
            }
        }

        boolean matchedAnnotations = visitAttributes(node, reflectInfo);
View Full Code Here

    public Object visit(SimpleNode node, Object data) {
        return node.jjtGetChild(0).jjtAccept(this, data);
    }

    public Object visit(ASTRoot node, Object data) {
        Node child = node.jjtGetChild(0);
        Boolean match = (Boolean) child.jjtAccept(this, data);
        return match;
    }
View Full Code Here

        Boolean match = (Boolean) child.jjtAccept(this, data);
        return match;
    }

    public Object visit(ASTExpression node, Object data) {
        Node child = node.jjtGetChild(0);
        Boolean match = (Boolean) child.jjtAccept(this, data);
        return match;
    }
View Full Code Here

    public Object visit(ASTExecution node, Object data) {
        ExpressionContext context = (ExpressionContext) data;

        // only the last node might be the pattern, others are annotations
        Node patternNode = node.jjtGetChild(node.jjtGetNumChildren() - 1);
        boolean checkPattern = !(patternNode instanceof ASTAttribute);
       
        if(checkPattern) {
            if (context.hasWithinPointcut() || context.hasExecutionPointcut()) {
                if (context.hasExecutionPointcut()) {
                    // reflectionInfo was given
                    return patternNode.jjtAccept(this, context.getReflectionInfo());
                } else {
                    // only withinInfo was given
                    return patternNode.jjtAccept(this, context.getWithinReflectionInfo());
                }
            } else {
                return Boolean.FALSE;
            }
        } else {
View Full Code Here

    public Object visit(ASTCall node, Object data) {
        ExpressionContext context = (ExpressionContext) data;
       
        // only the last node might be the pattern, others are annotations
        Node patternNode = node.jjtGetChild(node.jjtGetNumChildren() - 1);
        boolean checkPattern = !(patternNode instanceof ASTAttribute);
       
        if(checkPattern) {
            if (context.hasWithinPointcut() || context.hasCallPointcut()) {
                if (context.hasReflectionInfo()) {
                        return patternNode.jjtAccept(this, context.getReflectionInfo());
                } else {
                    return null;
                }
            } else {
                return Boolean.FALSE;
View Full Code Here

TOP

Related Classes of org.codehaus.aspectwerkz.expression.ast.Node

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.