Package org.codehaus.aspectwerkz.expression

Examples of org.codehaus.aspectwerkz.expression.ExpressionInfo


        assertTrue(new ExpressionInfo("call(public static void test.expression.Target.modifiers2())", NAMESPACE)
                .getExpression().match(new ExpressionContext(PointcutType.CALL, modifiers2, null)));
    }

    public void testMethodModifiers3() throws Exception {
        assertFalse(new ExpressionInfo("call(public void test.expression.Target.modifiers3())", NAMESPACE)
                .getExpression().match(new ExpressionContext(PointcutType.CALL, modifiers3, null)));
        assertTrue(new ExpressionInfo("call(void test.expression.Target.modifiers3())", NAMESPACE).getExpression()
                .match(new ExpressionContext(PointcutType.CALL, modifiers3, null)));
        assertTrue(new ExpressionInfo("call(static final void test.expression.Target.modifiers3())", NAMESPACE)
                .getExpression().match(new ExpressionContext(PointcutType.CALL, modifiers3, null)));
        assertFalse(new ExpressionInfo("call(public static native void test.expression.Target.modifiers3())", NAMESPACE)
                .getExpression().match(new ExpressionContext(PointcutType.CALL, modifiers3, null)));
        assertFalse(new ExpressionInfo("call(public static void test.expression.Target.modifiers3())", NAMESPACE)
                .getExpression().match(new ExpressionContext(PointcutType.CALL, modifiers3, null)));
        assertTrue(new ExpressionInfo("call(synchronized void test.expression.Target.modifiers3())", NAMESPACE)
                .getExpression().match(new ExpressionContext(PointcutType.CALL, modifiers3, null)));
        assertTrue(new ExpressionInfo(
            "call(protected native synchronized void test.expression.Target.modifiers3())",
            NAMESPACE).getExpression().match(new ExpressionContext(PointcutType.CALL, modifiers3, null)));
        assertTrue(new ExpressionInfo("call(native protected void test.expression.Target.modifiers3())", NAMESPACE)
                .getExpression().match(new ExpressionContext(PointcutType.CALL, modifiers3, null)));
    }
View Full Code Here


        assertTrue(new ExpressionInfo("call(native protected void test.expression.Target.modifiers3())", NAMESPACE)
                .getExpression().match(new ExpressionContext(PointcutType.CALL, modifiers3, null)));
    }

    public void testMethodModifiers4() throws Exception {
        assertFalse(new ExpressionInfo("call(public * test.expression.*.*(..)) && within(test.expression.*)", NAMESPACE)
                .getExpression().match(new ExpressionContext(PointcutType.CALL, modifiers4, s_declaringType)));
        assertTrue(new ExpressionInfo("call(private * test.expression.*.*(..)) && within(test.expression.*)", NAMESPACE)
                .getExpression().match(new ExpressionContext(PointcutType.CALL, modifiers4, s_declaringType)));
        assertFalse(new ExpressionInfo(
            "call(protected * test.expression.*.*(..)) && within(test.expression.*)",
            NAMESPACE).getExpression().match(new ExpressionContext(PointcutType.CALL, modifiers4, s_declaringType)));
    }
View Full Code Here

            "call(protected * test.expression.*.*(..)) && within(test.expression.*)",
            NAMESPACE).getExpression().match(new ExpressionContext(PointcutType.CALL, modifiers4, s_declaringType)));
    }

    public void testMethodModifiers5() throws Exception {
        assertFalse(new ExpressionInfo("call(!public void test.expression.Target.modifiers2())", NAMESPACE)
                .getExpression().match(new ExpressionContext(PointcutType.CALL, modifiers2, null)));
        assertFalse(new ExpressionInfo("call(NOT public void test.expression.Target.modifiers2())", NAMESPACE)
                .getExpression().match(new ExpressionContext(PointcutType.CALL, modifiers2, null)));
        assertTrue(new ExpressionInfo("call(!private void test.expression.Target.modifiers2())", NAMESPACE)
                .getExpression().match(new ExpressionContext(PointcutType.CALL, modifiers2, null)));
        assertTrue(new ExpressionInfo("call(!private static void test.expression.Target.modifiers2())", NAMESPACE)
                .getExpression().match(new ExpressionContext(PointcutType.CALL, modifiers2, null)));
        assertFalse(new ExpressionInfo("call(public !static void test.expression.Target.modifiers2())", NAMESPACE)
                .getExpression().match(new ExpressionContext(PointcutType.CALL, modifiers2, null)));
        assertFalse(new ExpressionInfo("call(public NOT static void test.expression.Target.modifiers2())", NAMESPACE)
                .getExpression().match(new ExpressionContext(PointcutType.CALL, modifiers2, null)));
    }
View Full Code Here

                .getExpression().match(new ExpressionContext(PointcutType.CALL, modifiers2, null)));
    }

    // ============ method parameters test =============
    public void testMethodParameters1() throws Exception {
        assertTrue(new ExpressionInfo("call(void test.expression.Target.parameters1())", NAMESPACE).getExpression()
                .match(new ExpressionContext(PointcutType.CALL, parameters1, null)));
        assertTrue(new ExpressionInfo("call(void test.expression.Target.parameters1(..))", NAMESPACE).getExpression()
                .match(new ExpressionContext(PointcutType.CALL, parameters1, null)));
        assertFalse(new ExpressionInfo("call(void test.expression.Target.parameters1(*))", NAMESPACE).getExpression()
                .match(new ExpressionContext(PointcutType.CALL, parameters1, null)));
        assertFalse(new ExpressionInfo("call(void test.expression.Target.parameters1(int))", NAMESPACE).getExpression()
                .match(new ExpressionContext(PointcutType.CALL, parameters1, null)));
    }
View Full Code Here

        // do a lookup first to avoid infinite recursion when:
        // <pointcut name="pc" ...> [will be registered as pc]
        // <advice bind-to="pc" ...> [will be registered as pc and should not override previous one !]
        ExpressionNamespace namespace = ExpressionNamespace.getNamespace(aspectDef.getFullQualifiedName());
        ExpressionInfo info = namespace.getExpressionInfo(pointcutName);
        if (info == null) {
            info = new ExpressionInfo(expression, aspectDef.getFullQualifiedName());
            // extract the pointcut signature map
            if (pointcutCallSignature != null) {
                String[] parameters = Strings.splitString(pointcutCallSignature, ",");
                for (int i = 0; i < parameters.length; i++) {
                    String[] parameterInfo = Strings.splitString(Strings.replaceSubString(
                        parameters[i].trim(),
                        "  ",
                        " "), " ");
                    info.addArgument(parameterInfo[1], parameterInfo[0]);
                }
            }
        }
        ExpressionNamespace.getNamespace(aspectDef.getFullQualifiedName()).addExpressionInfo(pointcutName, info);
View Full Code Here

        assertFalse(new ExpressionInfo("call(void test.expression.Target.parameters1(int))", NAMESPACE).getExpression()
                .match(new ExpressionContext(PointcutType.CALL, parameters1, null)));
    }

    public void testMethodParameters2() throws Exception {
        assertFalse(new ExpressionInfo("call(void test.expression.Target.parameters2())", NAMESPACE).getExpression()
                .match(new ExpressionContext(PointcutType.CALL, parameters2, null)));
        assertTrue(new ExpressionInfo("call(void test.expression.Target.parameters2(..))", NAMESPACE).getExpression()
                .match(new ExpressionContext(PointcutType.CALL, parameters2, null)));
        assertTrue(new ExpressionInfo("call(void test.expression.Target.parameters2(int, ..))", NAMESPACE)
                .getExpression().match(new ExpressionContext(PointcutType.CALL, parameters2, null)));
        assertTrue(new ExpressionInfo("call(void test.expression.Target.parameters2(int, float, byte))", NAMESPACE)
                .getExpression().match(new ExpressionContext(PointcutType.CALL, parameters2, null)));
        assertTrue(new ExpressionInfo("call(void test.expression.Target.parameters2(int, *, *))", NAMESPACE)
                .getExpression().match(new ExpressionContext(PointcutType.CALL, parameters2, null)));
        assertFalse(new ExpressionInfo("call(void test.expression.Target.parameters2(int, int, byte))", NAMESPACE)
                .getExpression().match(new ExpressionContext(PointcutType.CALL, parameters2, null)));
        assertTrue(new ExpressionInfo("call(void test.expression.Target.parameters2(*, *, byte))", NAMESPACE)
                .getExpression().match(new ExpressionContext(PointcutType.CALL, parameters2, null)));
    }
View Full Code Here

        final String aspectClassName,
        final String expression,
        final Method method,
        final int methodIndex,
        final AspectDefinition aspectDef) {
        ExpressionInfo expressionInfo = new ExpressionInfo(expression, aspectDef.getFullQualifiedName());

        // support for pointcut signature
        String adviceCallSignature = null;
        if (adviceName.indexOf('(') > 0) {
            adviceCallSignature = adviceName.substring(adviceName.indexOf('(') + 1, adviceName.lastIndexOf(')'));
            String[] parameters = Strings.splitString(adviceCallSignature, ",");
            for (int i = 0; i < parameters.length; i++) {
                String[] parameterInfo = Strings.splitString(
                    Strings.replaceSubString(parameters[i].trim(), "  ", " "),
                    " ");
                expressionInfo.addArgument(parameterInfo[1], parameterInfo[0]);
            }
        }

        final AdviceDefinition adviceDef = new AdviceDefinition(
            adviceName,
View Full Code Here

        assertTrue(new ExpressionInfo("call(void test.expression.Target.parameters2(*, *, byte))", NAMESPACE)
                .getExpression().match(new ExpressionContext(PointcutType.CALL, parameters2, null)));
    }

    public void testMethodParameters3() throws Exception {
        assertFalse(new ExpressionInfo("call(void test.expression.Target.parameters3())", NAMESPACE).getExpression()
                .match(new ExpressionContext(PointcutType.CALL, parameters3, null)));
        assertTrue(new ExpressionInfo("call(void test.expression.Target.parameters3(..))", NAMESPACE).getExpression()
                .match(new ExpressionContext(PointcutType.CALL, parameters3, null)));
        assertFalse(new ExpressionInfo("call(void test.expression.Target.parameters3(int, ..))", NAMESPACE)
                .getExpression().match(new ExpressionContext(PointcutType.CALL, parameters3, null)));
        assertTrue(new ExpressionInfo("call(void test.expression.Target.parameters3(String, ..))", NAMESPACE)
                .getExpression().match(new ExpressionContext(PointcutType.CALL, parameters3, null)));
        assertFalse(new ExpressionInfo(
            "call(void test.expression.Target.parameters3(String, String, String))",
            NAMESPACE).getExpression().match(new ExpressionContext(PointcutType.CALL, parameters3, null)));
        assertTrue(new ExpressionInfo(
            "call(void test.expression.Target.parameters3(String, StringBuffer, String))",
            NAMESPACE).getExpression().match(new ExpressionContext(PointcutType.CALL, parameters3, null)));
        assertFalse(new ExpressionInfo(
            "call(void test.expression.Target.parameters3(String, StringBuffer, String, *))",
            NAMESPACE).getExpression().match(new ExpressionContext(PointcutType.CALL, parameters3, null)));
    }
View Full Code Here

    public static IntroductionDefinition createIntroductionDefinition(
        final Class mixinClass,
        final String expression,
        final String deploymentModel,
        final AspectDefinition aspectDef) {
        ExpressionInfo expressionInfo = new ExpressionInfo(expression, aspectDef.getFullQualifiedName());

        // auto-name the pointcut which is anonymous for introduction
        ExpressionNamespace.getNamespace(aspectDef.getFullQualifiedName()).addExpressionInfo(
            "AW_" + expression.hashCode(),
            expressionInfo);
View Full Code Here

    public static InterfaceIntroductionDefinition createInterfaceIntroductionDefinition(
        final String introductionName,
        final String expression,
        final String interfaceClassName,
        final AspectDefinition aspectDef) {
        ExpressionInfo expressionInfo = new ExpressionInfo(expression, aspectDef.getFullQualifiedName());

        // auto-name the pointcut which is anonymous for introduction
        ExpressionNamespace.getNamespace(aspectDef.getFullQualifiedName()).addExpressionInfo(
            "AW_" + expression.hashCode(),
            expressionInfo);
View Full Code Here

TOP

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

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.