Package org.codehaus.aspectwerkz.expression.regexp

Examples of org.codehaus.aspectwerkz.expression.regexp.TypePattern


    }

    // ============ Patterns =============
    public Object visit(ASTClassPattern node, Object data) {
        ClassInfo classInfo = (ClassInfo) data;
        TypePattern typePattern = node.getTypePattern();
        if (typePattern.matchType(classInfo)
            && visitAttributes(node, classInfo)
            && visitModifiers(node, classInfo)) {
            return Boolean.TRUE;
        } else {
            return Boolean.FALSE;
View Full Code Here


    public Object visit(ASTArgParameter node, Object data) {
        //TODO we are not doing any hierarchical test when the arg is bound
        // => args(e) and before(Exception e) will not mathch on catch(SubException e) ..
        // is that required ? how AJ syntax behaves ?

        TypePattern typePattern = node.getTypePattern();
        TypePattern realPattern = typePattern;

        // check if the arg is in the pointcut signature. In such a case, use the declared type
        //TODO can we improve that with a lazy attach of the realTypePattern to the node
        // and a method that always return the real pattern
        // It must be lazy since args are not added at info ctor time [can be refactored..]
        // do some filtering first to avoid unnecessary map lookup
       
        int pointcutArgIndex = -1;
        if (typePattern.getPattern().indexOf(".") < 0) {
            String boundedType = m_expressionInfo.getArgumentType(typePattern.getPattern());
            if (boundedType != null) {
                pointcutArgIndex = m_expressionInfo.getArgumentIndex(typePattern.getPattern());
                realPattern = TypePattern.compileTypePattern(boundedType, SubtypePatternType.NOT_HIERARCHICAL);
            }
        }
        // grab parameter from context
        ExpressionContext ctx = (ExpressionContext) data;
        ClassInfo argInfo = null;
        try {
            if (ctx.getReflectionInfo() instanceof MethodInfo) {
                argInfo = ((MethodInfo) ctx.getReflectionInfo()).getParameterTypes()[ctx.getCurrentTargetArgsIndex()];
            } else if (ctx.getReflectionInfo() instanceof ConstructorInfo) {
                argInfo = ((ConstructorInfo) ctx.getReflectionInfo()).getParameterTypes()[ctx
                        .getCurrentTargetArgsIndex()];
            } else if (ctx.getReflectionInfo() instanceof FieldInfo) {
                argInfo = ((FieldInfo) ctx.getReflectionInfo()).getType();
            } else if (ctx.getPointcutType().equals(PointcutType.HANDLER) && ctx.getReflectionInfo() instanceof ClassInfo) {
                argInfo = (ClassInfo) ctx.getReflectionInfo();
            }
        } catch (ArrayIndexOutOfBoundsException e) {
            // ExpressionContext args are exhausted
            return Boolean.FALSE;
        }
        if (realPattern.matchType(argInfo)) {
            return Boolean.TRUE;
        } else {
            return Boolean.FALSE;
        }
    }
View Full Code Here



    public Object visit(ASTArgParameter node, Object data) {

        TypePattern typePattern = node.getTypePattern();

        TypePattern realPattern = typePattern;



        // check if the arg is in the pointcut signature. In such a case, use the declared type
View Full Code Here



    public Object visit(ASTArgParameter node, Object data) {

        TypePattern typePattern = node.getTypePattern();

        ((List)data).add(typePattern.getPattern());

        return data;

    }
View Full Code Here

    public Object visit(ASTClassPattern node, Object data) {

        ClassInfo classInfo = (ClassInfo) data;

        TypePattern typePattern = node.getTypePattern();

        if (ClassInfoHelper.matchType(typePattern, classInfo)

            && visitAttributes(node, classInfo)
View Full Code Here

    }

    // ============ Patterns =============
    public Object visit(ASTClassPattern node, Object data) {
        ClassInfo classInfo = (ClassInfo) data;
        TypePattern typePattern = node.getTypePattern();
        if (ClassInfoHelper.matchType(typePattern, classInfo)
            && visitAttributes(node, classInfo)
            && visitModifiers(node, classInfo)) {
            return Boolean.TRUE;
        } else {
View Full Code Here

            }
        }
    }

    public Object visit(ASTArgParameter node, Object data) {
        TypePattern typePattern = node.getTypePattern();
        TypePattern realPattern = typePattern;

        // check if the arg is in the pointcut signature. In such a case, use the declared type
        //TODO can we improve that with a lazy attach of the realTypePattern to the node
        // and a method that always return the real pattern
        // It must be lazy since args are not added at info ctor time [can be refactored..]
View Full Code Here

    }
    // ============ Patterns =============
    public Object visit(ASTClassPattern node, Object data) {
        ClassInfo classInfo = (ClassInfo) data;
        TypePattern typePattern = node.getTypePattern();
        if (ClassInfoHelper.matchType(typePattern, classInfo) && visitAttributes(node, classInfo)) {
            return Boolean.TRUE;
        } else {
            return Boolean.FALSE;
        }
View Full Code Here

        }
        return data;
    }

    public Object visit(ASTArgParameter node, Object data) {
        TypePattern typePattern = node.getTypePattern();
        ((List) data).add(typePattern.getPattern());
        return data;
    }
View Full Code Here

        if (data instanceof ClassInfo) {

          ClassInfo classInfo = (ClassInfo) data;

          TypePattern typePattern = node.getTypePattern();



          if (typePattern.matchType(classInfo)

            && visitModifiers(node, classInfo)) {

              return Boolean.TRUE;
View Full Code Here

TOP

Related Classes of org.codehaus.aspectwerkz.expression.regexp.TypePattern

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.