Package org.codehaus.aspectwerkz.expression

Examples of org.codehaus.aspectwerkz.expression.ExpressionVisitor


            for (Iterator it = aspectDef.getInterfaceIntroductionDefinitions().iterator(); it.hasNext();) {
                InterfaceIntroductionDefinition introDef = (InterfaceIntroductionDefinition) it.next();
                ExpressionInfo[] expressionInfos = introDef.getExpressionInfos();
                for (int i = 0; i < expressionInfos.length; i++) {
                    ExpressionInfo expressionInfo = expressionInfos[i];
                    ExpressionVisitor expression = expressionInfo.getExpression();
                    if (expression.match(ctx)) {
                        interfaceIntroductionDefs.add(introDef);
                    }
                }
            }
        }
View Full Code Here


                AdviceDefinition adviceDef = (AdviceDefinition) it2.next();
                final ExpressionInfo expressionInfo = adviceDef.getExpressionInfo();
                if (expressionInfo == null) {
                    continue;
                }
                ExpressionVisitor expression = expressionInfo.getExpression();

                if (expression.match(ctx)) {
                    if (AspectWerkzPreProcessor.DETAILS) {
                        System.out.println(
                                "[TRACE - match: " + expression + " @ "
                                + aspectDef.getQualifiedName() + "/" +
                                adviceDef.getName()
View Full Code Here

        for (Iterator it = m_interfaceIntroductionMap.values().iterator(); it.hasNext();) {
            InterfaceIntroductionDefinition introDef = (InterfaceIntroductionDefinition) it.next();
            ExpressionInfo[] expressionInfos = introDef.getExpressionInfos();
            for (int i = 0; i < expressionInfos.length; i++) {
                ExpressionInfo expressionInfo = expressionInfos[i];
                ExpressionVisitor expression = expressionInfo.getExpression();
                if (expression.match(ctx)) {
                    interfaceIntroductionDefs.add(introDef);
                }
            }
        }
        return interfaceIntroductionDefs;
View Full Code Here

        for (Iterator it = m_introductionMap.values().iterator(); it.hasNext();) {
            IntroductionDefinition introDef = (IntroductionDefinition) it.next();
            ExpressionInfo[] expressionInfos = introDef.getExpressionInfos();
            for (int i = 0; i < expressionInfos.length; i++) {
                ExpressionInfo expressionInfo = expressionInfos[i];
                ExpressionVisitor expression = expressionInfo.getExpression();
                if (expression.match(ctx)) {
                    return true;
                }
            }
        }
        return false;
View Full Code Here

        }
        for (Iterator it = m_aspectMap.values().iterator(); it.hasNext();) {
            AspectDefinition aspectDef = (AspectDefinition) it.next();
            for (Iterator it2 = aspectDef.getAllAdvices().iterator(); it2.hasNext();) {
                AdviceDefinition adviceDef = (AdviceDefinition) it2.next();
                ExpressionVisitor expression = adviceDef.getExpressionInfo().getExpression();
                if (expression.match(ctx)) {
                    return true;
                }
            }
        }
        return false;
View Full Code Here

                .match(new ExpressionContext(PointcutType.EXECUTION, modifiers1, s_declaringType)));
        assertTrue(new ExpressionInfo(
            "execution(void test.expression.Target.modifiers1()) && !call(void test.expression.Target.modifiers1())",
            NAMESPACE).getExpression()
                .match(new ExpressionContext(PointcutType.EXECUTION, modifiers1, s_declaringType)));
        ExpressionVisitor expression = new ExpressionInfo(
            "execution(void test.expression.Target.modifiers1()) && !call(void test.expression.Target.modifiers3()) && !(call(void test.expression.Target.modifiers1()) || call(void test.expression.Target.modifiers2()))",
            NAMESPACE).getExpression();
        assertTrue(expression.match(new ExpressionContext(PointcutType.EXECUTION, modifiers1, s_declaringType)));
        assertFalse(expression.match(new ExpressionContext(PointcutType.CALL, modifiers1, s_declaringType)));
        assertFalse(expression.match(new ExpressionContext(PointcutType.SET, modifier1, s_declaringType)));
        assertFalse(new ExpressionInfo(
            "call(void test.expression.Target.modifiers1()) && !set(int test.expression.Target.modifier1)",
            NAMESPACE).getExpression().match(new ExpressionContext(PointcutType.CALL, modifier1, null)));
    }
View Full Code Here

     */
    private void addAdviceToMethods(final String methodPattern,
                                    final Advice advice,
                                    final MethodInfo[] methods) {
        ExpressionInfo expressionInfo = new ExpressionInfo("execution(" + methodPattern + ')', EXPRESSION_NAMESPACE);
        ExpressionVisitor expression = expressionInfo.getExpression();
        for (int i = 0; i < methods.length; i++) {
            MethodInfo method = methods[i];
            if (method.getName().startsWith(TransformationConstants.SYNTHETIC_MEMBER_PREFIX)) {
                continue;
            }
            if (expression.match(new ExpressionContext(PointcutType.EXECUTION, method, null))) {
                int joinPointHash = AsmHelper.calculateMethodHash(method.getName(), method.getSignature());
                addAroundAdvice(advice, joinPointHash);
                addBeforeAdvice(advice, joinPointHash);
                addAfterAdvice(advice, joinPointHash);
                addAfterReturningAdvice(advice, joinPointHash);
View Full Code Here

     */
    private void addAdviceToFields(final String fieldPattern,
                                   final Advice advice,
                                   final FieldInfo[] fields) {
        ExpressionInfo expressionInfo = new ExpressionInfo("set(" + fieldPattern + ')', EXPRESSION_NAMESPACE);
        ExpressionVisitor expression = expressionInfo.getExpression();
        for (int i = 0; i < fields.length; i++) {
            FieldInfo field = fields[i];
            if (field.getName().startsWith(TransformationConstants.SYNTHETIC_MEMBER_PREFIX)) {
                continue;
            }
            if (expression.match(new ExpressionContext(PointcutType.SET, field, null))) {
                int joinPointHash = AsmHelper.calculateFieldHash(field.getName(), field.getSignature());
                addAroundAdvice(advice, joinPointHash);
                addBeforeAdvice(advice, joinPointHash);
                addAfterAdvice(advice, joinPointHash);
                addAfterReturningAdvice(advice, joinPointHash);
View Full Code Here

     */
    private void removeAdviceFromMethods(final String methodPattern,
                                         final Class adviceClass,
                                         final MethodInfo[] methods) {
        ExpressionInfo expressionInfo = new ExpressionInfo("execution(" + methodPattern + ')', EXPRESSION_NAMESPACE);
        ExpressionVisitor expression = expressionInfo.getExpression();
        for (int i = 0; i < methods.length; i++) {
            MethodInfo method = methods[i];
            if (method.getName().startsWith(TransformationConstants.SYNTHETIC_MEMBER_PREFIX)) {
                continue;
            }
            if (expression.match(new ExpressionContext(PointcutType.EXECUTION, method, null))) {
                int joinPointHash = AsmHelper.calculateMethodHash(method.getName(), method.getSignature());
                removeAroundAdvice(adviceClass, joinPointHash);
                removeBeforeAdvice(adviceClass, joinPointHash);
                removeAfterAdvice(adviceClass, joinPointHash);
                removeAfterReturningAdvice(adviceClass, joinPointHash);
View Full Code Here

     */
    private void removeAdviceFromFields(final String fieldPattern,
                                        final Class adviceClass,
                                        final FieldInfo[] fields) {
        ExpressionInfo expressionInfo = new ExpressionInfo("set(" + fieldPattern + ')', EXPRESSION_NAMESPACE);
        ExpressionVisitor expression = expressionInfo.getExpression();
        for (int i = 0; i < fields.length; i++) {
            FieldInfo field = fields[i];
            if (field.getName().startsWith(TransformationConstants.SYNTHETIC_MEMBER_PREFIX)) {
                continue;
            }
            if (expression.match(new ExpressionContext(PointcutType.SET, field, null))) {
                int joinPointHash = AsmHelper.calculateFieldHash(field.getName(), field.getSignature());
                removeAroundAdvice(adviceClass, joinPointHash);
                removeBeforeAdvice(adviceClass, joinPointHash);
                removeAfterAdvice(adviceClass, joinPointHash);
                removeAfterReturningAdvice(adviceClass, joinPointHash);
View Full Code Here

TOP

Related Classes of org.codehaus.aspectwerkz.expression.ExpressionVisitor

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.