Package org.codehaus.aspectwerkz.reflect

Examples of org.codehaus.aspectwerkz.reflect.MethodInfo


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

    public void testCflowBelowTypes() throws Exception {
        MethodInfo method1 = JavaMethodInfo.getMethodInfo(Target.class.getDeclaredMethod("modifiers1", new Class[]{}));
        MethodInfo method2 = JavaMethodInfo.getMethodInfo(Target.class.getDeclaredMethod("modifiers2", new Class[]{}));
        MethodInfo method3 = JavaMethodInfo.getMethodInfo(Target.class.getDeclaredMethod("modifiers3", new Class[]{}));
        s_namespace.addExpressionInfo(
                "pc1", new ExpressionInfo(
                        "execution(void test.expression.Target.modifiers2())",
                        NAMESPACE
                )
View Full Code Here


    }

    // ============ within type tests =============
    public void testWithinType1() throws Exception {
        ClassInfo otherType = JavaClassInfo.getClassInfo(String.class);
        MethodInfo method = JavaMethodInfo.getMethodInfo(Target.class.getDeclaredMethod("modifiers1", new Class[]{}));
        assertTrue(
                new ExpressionInfo(
                        "execution(void test.expression.Target.modifiers1()) AND within(test.expression.Target)",
                        NAMESPACE
                ).getExpression().match(new ExpressionContext(PointcutType.EXECUTION, method, s_declaringType))
View Full Code Here

        );
    }

    public void testWithinType2() throws Exception {
        ClassInfo klass = JavaClassInfo.getClassInfo(Target.class);
        MethodInfo method = JavaMethodInfo.getMethodInfo(Target.class.getDeclaredMethod("modifiers1", new Class[]{}));
        assertTrue(
                new ExpressionInfo("execution(void *..*.modifiers1()) AND within(test.expression.Target)", NAMESPACE)
                .getAdvisedClassFilterExpression().match(
                        new ExpressionContext(PointcutType.EXECUTION, method, s_declaringType)
                )
View Full Code Here

                )
        );
    }

    public void testWithinCodeType() throws Exception {
        MethodInfo stringtoStringMethod = JavaMethodInfo.getMethodInfo(
                String.class.getDeclaredMethod("toString", new Class[]{})
        );
        MethodInfo method = JavaMethodInfo.getMethodInfo(Target.class.getDeclaredMethod("modifiers1", new Class[]{}));
        assertTrue(
                new ExpressionInfo(
                        "execution(void test.expression.Target.modifiers1()) AND withincode(void test.expression.Target.modifiers1())",
                        NAMESPACE
                ).getExpression().match(new ExpressionContext(PointcutType.EXECUTION, method, method))
View Full Code Here

        System.out.println("START");

        ClassInfo klass = AsmClassInfo.getClassInfo("test.annotation.AnnotationLoadingTarget", AnnotationLoadingTest.class.getClassLoader());

        MethodInfo m = klass.getMethods()[0];

        AnnotationInfo annInfo = (AnnotationInfo) m.getAnnotations().get(0);



        System.out.println("DONE");
View Full Code Here



        for (int i = 0; i < methods.length; i++) {

            MethodInfo method = methods[i];

            if (method.getName().equals("method")) {

                checkMethod(method);

            } else if (method.getName().equals("smethod")) {

                checkStaticMethod(method);

            }
View Full Code Here

        assertNotNull("java.util.SortedSet should be found", clazzInfo);



        MethodInfo inIntfMethodInfo = clazzInfo.getMethod(inIntfMethodHash);

        assertNotNull("first() method info should be found directly", inIntfMethodInfo);



        MethodInfo inSuperMethodInfo = clazzInfo.getMethod(inSuperMethodHash);

//        assertNotNull("isEmpty() method info from super interface", inSuperMethodInfo);



        ClassInfo clazzInfo2 = JavaClassInfo.getClassInfo(java.util.SortedSet.class);

        assertNotNull("java.util.SortedSet should be found", clazzInfo);



        MethodInfo inIntfMethodInfo2 = clazzInfo2.getMethod(inIntfMethodHash);

        assertNotNull("first() method info should be found directly", inIntfMethodInfo2);



        MethodInfo inSuperMethodInfo2 = clazzInfo2.getMethod(inSuperMethodHash);

        assertNotNull("isEmpty() method info from super interface", inSuperMethodInfo2);

    }
View Full Code Here

         void test(String[] s);//test2
    }

    public void testMethodComparison() {
        ClassInfo theTest = JavaClassInfo.getClassInfo(TestInterface.class);
        MethodInfo test1 = null;
        MethodInfo test2 = null;
        for (int i = 0; i < theTest.getMethods().length; i++) {
            MethodInfo methodInfo = theTest.getMethods()[i];
            if (methodInfo.getName().equals("test")) {
                if (methodInfo.getParameterTypes()[0].getSignature().startsWith("[")) {
                    test2 = methodInfo;
                } else {
                    test1 = methodInfo;
                }
            }
View Full Code Here

     */
    private AdviceDefinition handleAdviceInfo(final ClassInfo classInfo,
                                              final AspectDefinition aspectDef,
                                              final AdviceInfo ajAdviceInfo) {

        MethodInfo adviceMethod = null;
        MethodInfo[] methods = classInfo.getMethods();
        for (int i = 0; i < methods.length; i++) {
            MethodInfo method = methods[i];
            if (method.getName().equals(ajAdviceInfo.adviceMethodName)) {
                adviceMethod = method;
                break;
            }
        }
        if (adviceMethod == null) {
View Full Code Here

        try {

            Method m = DefaultValueTest.class.getDeclaredMethod("annotatedMethod", new Class[0]);

            MethodInfo mi = JavaMethodInfo.getMethodInfo(m);

            if (mi.getAnnotations().size() <= 0) {

                throw new Error("test corrupted");

            }
View Full Code Here

TOP

Related Classes of org.codehaus.aspectwerkz.reflect.MethodInfo

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.