Package org.nanocontainer.aop

Examples of org.nanocontainer.aop.MethodPointcut


    }

    public void testCustomMethodPointcut() {
        StringBuffer log = new StringBuffer();

        MethodPointcut customCut = new MethodPointcut() {
            public boolean picks(Method method) {
                return true;
            }
        };
View Full Code Here


    private Object createAspectNode(Map attributes, Object name) {
        ClassPointcut classCut = (ClassPointcut) attributes.remove("classCut");
        if(classCut != null) {
            currentClassCut = classCut;
        }
        MethodPointcut methodCut = (MethodPointcut) attributes.remove("methodCut");
        if(methodCut != null) {
            currentMethodCut = methodCut;
        }

        MethodInterceptor interceptor = (MethodInterceptor) attributes.remove("interceptor");
View Full Code Here

        assertTrue(cut.picks(Bar.class));
        assertFalse(cut.picks(FooBar.class));
    }

    public void testAllMethods() {
        MethodPointcut cut = cuts.allMethods();
        Method[] methods = Foo.class.getMethods();
        for (int i = 0; i < methods.length; ++i) {
            assertTrue(cut.picks(methods[i]));
        }
    }
View Full Code Here

            assertTrue(cut.picks(methods[i]));
        }
    }

    public void testGetMethods() {
        MethodPointcut cut = cuts.getMethods();
        assertTrue(cut.picks(getA));
        assertTrue(cut.picks(getB));
        assertTrue(cut.picks(misleadingGetA));
        assertFalse(cut.picks(isA));
        assertFalse(cut.picks(isB));
        assertFalse(cut.picks(setA));
        assertFalse(cut.picks(setB));
        assertFalse(cut.picks(apple));
        assertFalse(cut.picks(apricot));
        assertFalse(cut.picks(banana));
    }
View Full Code Here

        assertFalse(cut.picks(apricot));
        assertFalse(cut.picks(banana));
    }

    public void testIsMethods() {
        MethodPointcut cut = cuts.isMethods();
        assertFalse(cut.picks(getA));
        assertFalse(cut.picks(getB));
        assertTrue(cut.picks(isA));
        assertTrue(cut.picks(isB));
        assertFalse(cut.picks(setA));
        assertFalse(cut.picks(setB));
        assertFalse(cut.picks(apple));
        assertFalse(cut.picks(apricot));
        assertFalse(cut.picks(banana));
    }
View Full Code Here

        assertFalse(cut.picks(apricot));
        assertFalse(cut.picks(banana));
    }

    public void testSetMethods() {
        MethodPointcut cut = cuts.setMethods();
        assertFalse(cut.picks(getA));
        assertFalse(cut.picks(getB));
        assertFalse(cut.picks(isA));
        assertFalse(cut.picks(isB));
        assertTrue(cut.picks(setA));
        assertTrue(cut.picks(setB));
        assertFalse(cut.picks(apple));
        assertFalse(cut.picks(apricot));
        assertFalse(cut.picks(banana));
    }
View Full Code Here

        assertTrue(cuts.signature("get*").picks(getB));
        assertTrue(cuts.signature("get*").picks(misleadingGetA));
    }

    public void testOneMethod() {
        MethodPointcut cut = cuts.oneMethod(getA);
        assertTrue(cut.picks(getA));
        assertFalse(cut.picks(getB));
        assertFalse(cut.picks(isA));
        assertFalse(cut.picks(isB));
        assertFalse(cut.picks(setA));
        assertFalse(cut.picks(setB));
        assertFalse(cut.picks(apple));
        assertFalse(cut.picks(apricot));
        assertFalse(cut.picks(banana));
    }
View Full Code Here

        assertFalse(cut.picks(apricot));
        assertFalse(cut.picks(banana));
    }

    public void testReturnType() {
        MethodPointcut cut = cuts.returnType(cuts.oneClass(String.class));
        assertTrue(cut.picks(getA));
        assertTrue(cut.picks(getB));
        assertFalse(cut.picks(isA));
        assertFalse(cut.picks(isB));
        assertFalse(cut.picks(setA));
        assertFalse(cut.picks(setB));
        assertFalse(cut.picks(apple));
        assertFalse(cut.picks(apricot));
        assertFalse(cut.picks(banana));
    }
View Full Code Here

        assertFalse(cut.picks(apricot));
        assertFalse(cut.picks(banana));
    }

    public void testMethodPointcutIntersection() {
        MethodPointcut a = cuts.union(cuts.oneMethod(apple), cuts.oneMethod(apricot));
        MethodPointcut b = cuts.union(cuts.oneMethod(apple), cuts.oneMethod(banana));
        MethodPointcut c = cuts.intersection(a, b);

        assertTrue(c.picks(apple));
        assertFalse(c.picks(apricot));
        assertFalse(c.picks(banana));
    }
View Full Code Here

        assertFalse(c.picks(apricot));
        assertFalse(c.picks(banana));
    }

    public void testMethodPointcutNot() {
        MethodPointcut cut = cuts.not(cuts.oneMethod(getA));
        assertFalse(cut.picks(getA));
        assertTrue(cut.picks(getB));
        assertTrue(cut.picks(isA));
        assertTrue(cut.picks(isB));
        assertTrue(cut.picks(setA));
        assertTrue(cut.picks(setB));
        assertTrue(cut.picks(apple));
        assertTrue(cut.picks(apricot));
        assertTrue(cut.picks(banana));
    }
View Full Code Here

TOP

Related Classes of org.nanocontainer.aop.MethodPointcut

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.