Package org.nanocontainer.aop

Examples of org.nanocontainer.aop.ClassPointcut


    private Method hashCode;
    private Method toString;
    private Method subFooMethod;

    public void testAllClasses() {
        ClassPointcut cut = cuts.allClasses();
        assertTrue(cut.picks(Object.class));
        assertTrue(cut.picks(Serializable.class));
        assertTrue(cut.picks(Foo.class));
        assertTrue(cut.picks(this.getClass()));
    }
View Full Code Here


        assertTrue(cut.picks(Foo.class));
        assertTrue(cut.picks(this.getClass()));
    }

    public void testInstancesOf() {
        ClassPointcut cut = cuts.instancesOf(Serializable.class);
        assertTrue(cut.picks(Serializable.class));
        assertTrue(cut.picks(String.class));
        assertFalse(cut.picks(Foo.class));
    }
View Full Code Here

        assertTrue(cut.picks(String.class));
        assertFalse(cut.picks(Foo.class));
    }

    public void testClassName() {
        ClassPointcut cut = cuts.className("Foo*");
        assertTrue(cut.picks(Foo.class));
        assertTrue(cut.picks(FooBar.class));
        assertFalse(cut.picks(Bar.class));

        assertFalse(cuts.className("^Foo*").picks(Foo.class));
    }
View Full Code Here

        assertFalse(cuts.className("^Foo*").picks(Foo.class));
    }

    public void testOneClass() {
        ClassPointcut cut = cuts.oneClass(Foo.class);
        assertTrue(cut.picks(Foo.class));
        assertFalse(cut.picks(FooBar.class));
    }
View Full Code Here

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

    public void testPackageName() {
        ClassPointcut cut = cuts.packageName("org.nanocontainer.aop.dynaop");
        assertTrue(cut.picks(Foo.class));
        assertTrue(cut.picks(Bar.class));
        assertFalse(cut.picks(org.nanocontainer.aop.Dao.class));
    }
View Full Code Here

        assertTrue(cut.picks(Bar.class));
        assertFalse(cut.picks(org.nanocontainer.aop.Dao.class));
    }

    public void testClassPointcutIntersection() {
        ClassPointcut a = cuts.union(cuts.oneClass(Foo.class), cuts.oneClass(Bar.class));
        ClassPointcut b = cuts.union(cuts.oneClass(Foo.class), cuts.oneClass(FooBar.class));
        ClassPointcut c = cuts.intersection(a, b);
        assertTrue(c.picks(Foo.class));
        assertFalse(c.picks(Bar.class));
        assertFalse(c.picks(FooBar.class));
    }
View Full Code Here

        assertFalse(c.picks(Bar.class));
        assertFalse(c.picks(FooBar.class));
    }

    public void testClassPointcutNot() {
        ClassPointcut cut = cuts.not(cuts.oneClass(Foo.class));
        assertFalse(cut.picks(Foo.class));
        assertTrue(cut.picks(Bar.class));
    }
View Full Code Here

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

    public void testClassPointcutUnion() {
        ClassPointcut cut = cuts.union(cuts.oneClass(Foo.class), cuts.oneClass(Bar.class));
        assertTrue(cut.picks(Foo.class));
        assertTrue(cut.picks(Bar.class));
        assertFalse(cut.picks(FooBar.class));
    }
View Full Code Here

    }

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

        ClassPointcut customCut = new ClassPointcut() {
            public boolean picks(Class clazz) {
                return true;
            }
        };
View Full Code Here

        currentMethodCut = (MethodPointcut) attributes.remove("methodCut");
        return name;
    }

    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) {
View Full Code Here

TOP

Related Classes of org.nanocontainer.aop.ClassPointcut

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.