Examples of ClassesArchive


Examples of org.apache.xbean.finder.archive.ClassesArchive

* @version $Rev$ $Date$
*/
public class MetaAnnotatedMethodTest extends TestCase {

    public void test() throws Exception {
        AnnotationFinder finder = new AnnotationFinder(new ClassesArchive(Square.class, Circle.class, Triangle.class, Oval.class, Store.class, Farm.class, None.class)).link();

        Map<String, Annotated<Method>> map = new HashMap<String, Annotated<Method>>();

        List<Annotated<Method>> methods = finder.findMetaAnnotatedMethods(Color.class);
        for (Annotated<Method> method : methods) {
View Full Code Here

Examples of org.apache.xbean.finder.archive.ClassesArchive

    public static class Square extends Shape {
    }

    public void testFindSubclassesIncomplete() throws Exception {
        final AnnotationFinder finder = new AnnotationFinder(new ClassesArchive(Crimson.class, Square.class)).link();

        assertSubclasses(finder, Color.class, Red.class, Crimson.class);
        assertSubclasses(finder, Red.class, Crimson.class);
        assertSubclasses(finder, Crimson.class);
View Full Code Here

Examples of org.apache.xbean.finder.archive.ClassesArchive

        assertSubclasses(finder, Shape.class, Square.class);
        assertSubclasses(finder, Square.class);
    }

    public void testFindImplementations() throws Exception {
        final AnnotationFinder finder = new AnnotationFinder(new ClassesArchive(Crimson.class, Square.class)).link();

        assertImplementations(finder, HSB.class, Color.class, Red.class, Crimson.class);
        assertImplementations(finder, Hue.class, HSB.class, Color.class, Red.class, Crimson.class);
        assertImplementations(finder, Saturation.class, HSB.class, Color.class, Red.class, Crimson.class);
    }
View Full Code Here

Examples of org.apache.xbean.finder.archive.ClassesArchive

* @version $Rev$ $Date$
*/
public class MetaAnnotatedClassTest extends TestCase {

    public void test() throws Exception {
        AnnotationFinder finder = new AnnotationFinder(new ClassesArchive(Square.class, Circle.class, Triangle.class, Fake.class, Store.class, Farm.class, None.class)).link();

        Map<Class<?>, Annotated<Class<?>>> map = new HashMap<Class<?>, Annotated<Class<?>>>();

        List<Annotated<Class<?>>> metas = finder.findMetaAnnotatedClasses(Color.class);
        for (Annotated<Class<?>> meta : metas) {
View Full Code Here

Examples of org.apache.xbean.finder.archive.ClassesArchive

                    annotationFinder = af.select(names);
                    finder = af.select(clazz.getName());
                } else {
                    if (!dynamicBean) {
                        annotationFinder = createFinder(clazz);
                        finder = new AnnotationFinder(new ClassesArchive(clazz));
                    } else {
                        final Class<?>[] classes;
                        final Proxy proxy = metaClass.getAnnotation(Proxy.class);
                        if (proxy == null) {
                            classes = new Class<?>[]{clazz};
                        } else {
                            classes = new Class<?>[]{clazz, proxy.value()};
                        }
                        annotationFinder = createFinder(classes);
                        finder = new AnnotationFinder(new ClassesArchive(classes));
                    }
                }

                /*
                 * @PostConstruct
 
View Full Code Here

Examples of org.apache.xbean.finder.archive.ClassesArchive

            final Set<Class<?>> parents = new HashSet<Class<?>>();
            for (final Class<?> clazz : classes) {
                parents.addAll(Classes.ancestors(clazz));
            }

            return new AnnotationFinder(new ClassesArchive(parents)).link();
        }
View Full Code Here

Examples of org.apache.xbean.finder.archive.ClassesArchive

                    final EnterpriseBean bean = (EnterpriseBean) obj;
                    final EjbJar ejbJar = new EjbJar(method.getName());
                    ejbJar.addEnterpriseBean(bean);
                    EjbModule ejbModule = new EjbModule(ejbJar);
                    Class<?> clazz = Thread.currentThread().getContextClassLoader().loadClass(bean.getEjbClass());
                    ejbModule.setFinder(new AnnotationFinder(new ClassesArchive(clazz)).link());
                    appModule.getEjbModules().add(ejbModule);

                } else if (obj instanceof Application) {

                    application = (Application) obj;
                    setId(application, method);

                } else if (obj instanceof Connector) {

                    final Connector connector = (Connector) obj;
                    setId(connector, method);
                    appModule.getConnectorModules().add(new ConnectorModule(connector));

                } else if (obj instanceof Persistence) {

                    final Persistence persistence = (Persistence) obj;
                    appModule.getPersistenceModules().add(new PersistenceModule("", persistence));

                } else if (obj instanceof PersistenceUnit) {

                    final PersistenceUnit unit = (PersistenceUnit) obj;
                    appModule.getPersistenceModules().add(new PersistenceModule("", new Persistence(unit)));

                } else if (obj instanceof Beans) {

                    final Beans beans = (Beans) obj;
                    final EjbModule ejbModule = new EjbModule(new EjbJar(method.getName()));
                    ejbModule.setBeans(beans);
                    appModule.getEjbModules().add(ejbModule);

                } else if (obj instanceof Class[]) {

                    final Class[] beans = (Class[]) obj;
                    final EjbModule ejbModule = new EjbModule(new EjbJar(method.getName()));
                    ejbModule.setFinder(new AnnotationFinder(new ClassesArchive(beans)).link());
                    ejbModule.setBeans(new Beans());
                    appModule.getEjbModules().add(ejbModule);
                } else if (obj instanceof Class) {

                    final Class bean = (Class) obj;
                    final EjbModule ejbModule = new EjbModule(new EjbJar(method.getName()));
                    ejbModule.setFinder(new AnnotationFinder(new ClassesArchive(bean)).link());
                    ejbModule.setBeans(new Beans());
                    appModule.getEjbModules().add(ejbModule);
                }
            }
View Full Code Here

Examples of org.apache.xbean.finder.archive.ClassesArchive

        webApp.setContextRoot("/my-web-app");
        webApp.setId("web");
        webApp.setVersion("2.5");
        WebModule webModule = new WebModule(webApp, webApp.getContextRoot(),
                Thread.currentThread().getContextClassLoader(), "myapp", webApp.getId());
        webModule.setFinder(new AnnotationFinder(new ClassesArchive(
                MyFirstRestClass.class, MySecondRestClass.class, MyNonListedRestClass.class,
                MyRESTApplication.class, MyExpertRestClass.class, HookedRest.class, RestWithInjections.class)).link());

        Assembler assembler = new Assembler();
        SystemInstance.get().setComponent(Assembler.class, assembler);
View Full Code Here

Examples of org.apache.xbean.finder.archive.ClassesArchive

    }


    @Test
    public void testSortClasses() throws Exception {
        AnnotationFinder finder = new AnnotationFinder(new ClassesArchive(Emerald.class)).link();

        List<Annotated<Class<?>>> classes = finder.findMetaAnnotatedClasses(Resource.class);
        assertTrue(classes.size() >= 3);

        List<Annotated<Class<?>>> sorted = AnnotationDeployer.sortClasses(classes);
View Full Code Here

Examples of org.apache.xbean.finder.archive.ClassesArchive

        assertEquals(Color.class, sorted.get(2).get());
    }

    @Test
    public void testSortMethods() throws Exception {
        AnnotationFinder finder = new AnnotationFinder(new ClassesArchive(Emerald.class)).link();

        List<Annotated<Method>> classes = finder.findMetaAnnotatedMethods(Resource.class);
        assertTrue(classes.size() >= 3);

        List<Annotated<Method>> sorted = AnnotationDeployer.sortMethods(classes);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.