Package org.reflections

Examples of org.reflections.reflections$TestModel$MAI1$annotations


    }
   
    @Override
    public Set<Class<?>> scanControllers(List<String> packages) {
       
        Reflections reflections = new Reflections(packages.toArray());
        Set<Class<?>> controllerClasses = reflections.getTypesAnnotatedWith(StatelessController.class);
        controllerClasses.addAll(reflections.getTypesAnnotatedWith(StatefulController.class));
        controllerClasses.addAll(reflections.getTypesAnnotatedWith(SingletonController.class));
        return controllerClasses;
    }
View Full Code Here


    }

    @Override
    public Set<Class<? extends EntityMarshaller>> scanEntityMarshallers(List<String> packages) {
       
        Reflections reflections = new Reflections(packages.toArray());
        Set<Class<? extends EntityMarshaller>> customMarshallers =
                reflections.getSubTypesOf(EntityMarshaller.class);
        removeNonInstantiableClasses(customMarshallers);
        return customMarshallers;
    }
View Full Code Here

    private final List<OnStartListener> onStartListeners = new CopyOnWriteArrayList<OnStartListener>();
    private final List<OnStopListener> onStopListeners = new CopyOnWriteArrayList<OnStopListener>();

    @Override
    public void beforeStart(final Application application) {
        final Reflections reflections = new Reflections(new ConfigurationBuilder()
                .filterInputsBy(new FilterBuilder.Exclude(FilterBuilder.prefix("com.google")))
                .addUrls(ClasspathHelper.forClassLoader(application.classloader()))
                .addScanners(
                        new SubTypesScanner()
                ));

        // automatic Guice module detection
        Set<Class<? extends AbstractModule>> guiceModules = reflections.getSubTypesOf(AbstractModule.class);
        for (Class<? extends Module> moduleClass : guiceModules) {
            try {
                if (!moduleClass.isAnonymousClass()) {
                    modules.add(moduleClass.newInstance());
                }
            } catch (InstantiationException e) {
                throw Throwables.propagate(e);
            } catch (IllegalAccessException e) {
                throw Throwables.propagate(e);
            }
        }

        modules.add(new AbstractModule() {
            @Override
            protected void configure() {
                bind(Application.class).toInstance(application);
                bind(Reflections.class).toInstance(reflections);

                Names.bindProperties(this.binder(), fromKeys(application.configuration().keys(), new Function<String, String>() {
                    @Override
                    public String apply(String key) {
                        if (key.contains("akka")) return null;

                        return application.configuration().getString(key);
                    }
                }));

                for (Class<? extends Controller> controllerClass : reflections.getSubTypesOf(Controller.class)) {
                    Logger.info("Static injection for " + controllerClass);

                    requestStaticInjection(controllerClass);
                }

                // bind all services
                Multibinder<Service> serviceBinder = Multibinder.newSetBinder(binder(), Service.class);
                for (Class<? extends Service> serviceImplClass : reflections.getSubTypesOf(AbstractService.class)) {
                    serviceBinder.addBinding().to(serviceImplClass).asEagerSingleton();
                }
                for (Class<? extends Service> serviceImplClass : reflections.getSubTypesOf(AbstractIdleService.class)) {
                    serviceBinder.addBinding().to(serviceImplClass).asEagerSingleton();
                }
                for (Class<? extends Service> serviceImplClass : reflections.getSubTypesOf(AbstractExecutionThreadService.class)) {
                    serviceBinder.addBinding().to(serviceImplClass).asEagerSingleton();
                }

                // bind actor - todo use reflections for this
                bind(ActorRef.class).annotatedWith(Names.named("ProcessCPOCsvEntry"))
View Full Code Here

      URL url = urlIter.next();
      if(url.toString().toLowerCase().endsWith(".jar")) {
        urls.add(url);
      }
    }
    Reflections ref = new Reflections(new ConfigurationBuilder().setUrls(urls));
    for(Class<? extends ChannelHandler> clazz: ref.getSubTypesOf(ChannelHandler.class)) {
      if(Modifier.isAbstract(clazz.getModifiers())) continue;
      ChannelHandler.Sharable shareable = clazz.getAnnotation(ChannelHandler.Sharable.class);
      if(shareable==null) {
        notSharable.add(clazz);
      } else {
View Full Code Here

        if (pkgs == null || pkgs.length == 0)
        {
            throw new IllegalArgumentException("The list of packages to find classes should contain at least one item.");
        }

        reflections = new Reflections(pkgs);
    }
View Full Code Here

     * Provides all classes in package 'com.jcabi.github'.
     * @return Classes
     */
    public Iterable<Class<?>> allTypes() {
        return Iterables.filter(
            new Reflections(
                new ConfigurationBuilder()
                    .setScanners(
                        new SubTypesScanner(false),
                        new ResourcesScanner()
                )
View Full Code Here

            extends AbstractService
            implements ClassDiscoveryService {

    @Override
    public <T> Set<Class<? extends T>> findSubTypesOfClasses(Class<T> type) {
        final Reflections reflections = new Reflections(
                ClasspathHelper.forClassLoader(Thread.currentThread().getContextClassLoader()),
                ClasspathHelper.forClass(Object.class),
                new SubTypesScanner(false));
        return reflections.getSubTypesOf(type);
    }
View Full Code Here

    protected final Reflections reflections;
    protected IndentPrinter out;
   
    protected AbstractApplyToAllContractTest(
            final String packagePrefix) {
        reflections = new Reflections(packagePrefix);
        out = new IndentPrinter(new PrintWriter(ByteStreams.nullOutputStream()));
    }
View Full Code Here

     */
    public static Set<Class<? extends Structure>> findSubTypesOfStructure(final Class classDeclaredInSourceTreeToSearch) {

        // use: http://code.google.com/p/reflections/

        final Reflections reflections = new Reflections(new ConfigurationBuilder()
                .setScanners(new SubTypesScanner(false /* don't exclude Object.class */), new ResourcesScanner())
                .setUrls(ClasspathHelper.forClass(classDeclaredInSourceTreeToSearch))
        );

        return reflections.getSubTypesOf(Structure.class);
    }
View Full Code Here

    }

    private void registerAllPersistenceCapables() {

        for (final String packagePrefix : Iterables.transform(Splitter.on(",").split(packagePrefixes), trim())) {
            Reflections reflections = new Reflections(packagePrefix);
           
            Set<Class<?>> entityTypes =
                    reflections.getTypesAnnotatedWith(PersistenceCapable.class);
           
            if(noEntitiesIn(entityTypes)) {
                throw new IllegalStateException("Could not locate any @PersistenceCapable entities in package " + packagePrefix);
            }
            for (Class<?> entityType : entityTypes) {
View Full Code Here

TOP

Related Classes of org.reflections.reflections$TestModel$MAI1$annotations

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.