Package org.reflections

Examples of org.reflections.reflections$TestModel$Usage$C2$fields


     */
    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

            SortedMap<String, SortedSet<String>> positionedServices) {
        initIfRequired();

        for (final String packagePrefix : Iterables.transform(Splitter.on(",").split(packagePrefixes), trim())) {
            Vfs.setDefaultURLTypes(ClassDiscoveryServiceUsingReflections.getUrlTypes());
            Reflections reflections = new Reflections(packagePrefix);

            final Iterable<Class<?>> classes = Iterables.filter(
                    reflections.getTypesAnnotatedWith(DomainService.class), instantiatable());
            for (final Class<?> cls : classes) {

                final DomainService domainService = cls.getAnnotation(DomainService.class);
                final String order = domainService.menuOrder();
                final String serviceName = cls.getName();
View Full Code Here

    @Override
    public <T> Set<Class<? extends T>> findSubTypesOfClasses(Class<T> type) {
        Vfs.setDefaultURLTypes(getUrlTypes());

        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

    @Override
    public <T> Set<Class<? extends T>> findSubTypesOfClasses(Class<T> type, String packagePrefix) {
        Vfs.setDefaultURLTypes(getUrlTypes());

        final Reflections reflections = new Reflections(
                ClasspathHelper.forClassLoader(Thread.currentThread().getContextClassLoader()),
                ClasspathHelper.forClass(Object.class),
                ClasspathHelper.forPackage(packagePrefix),
                new SubTypesScanner(false)
        );
        return reflections.getSubTypesOf(type);
    }
View Full Code Here

      cp.importPackage("org.zkoss.cdi.util");
     
      CtClass mainclas = cp.makeClass("org.zkoss.zkplus.cdi.ZKComponentProducerMethods");
      final List<URL> l = getUrlsForCurrentClasspath();
     
      Reflections reflections = new Reflections(
          new ConfigurationBuilder().setUrls(l)
          .setScanners(new FieldAnnotationsScanner()));
     
      Set<Field> fields = reflections.getFieldsAnnotatedWith(ComponentId.class);
      for (Iterator iterator2 = fields.iterator(); iterator2
          .hasNext();) {
        Field field = (Field) iterator2.next();
        CtClass cls = cp.get(field.getType().getName());
        String pckgName = cls.getPackageName();
View Full Code Here

    }

    // Gets all classes with some annotation from a package
    public static Set<Class<?>> getClassesWithAnnotation(Class<? extends Annotation> annotation,
                                                         String[] packageNames) {
        Reflections reflections;
        Set<Class<?>> classes = new HashSet<Class<?>>();
        for(String packageName: packageNames) {
            reflections = new Reflections(packageName);
            classes.addAll(reflections.getTypesAnnotatedWith(annotation));
        }
        return classes;
    }
View Full Code Here

    return map;
  }

  private static Reflections getReflections(){
    if(REFLECTIONS == null){
      REFLECTIONS = new Reflections(new ConfigurationBuilder().setUrls(getMarkedPaths()).setScanners(subTypeScanner, annotationsScanner, resourcesScanner));
    }
    return REFLECTIONS;
  }
View Full Code Here

      }else{
        urlSet.addAll(getClasspathUrlsByManifest());
        //above procedure doesn't ensure to obtain 'WEB-INF/classes'
        urlSet.add(ClasspathHelper.getUrlForServletContextClasses(sce.getServletContext()));
      }
      Reflections reflections = new Reflections(
          new ConfigurationBuilder().setUrls(urlSet)
          .setScanners(new FieldAnnotationsScanner()));
     
      Set<Field> fields = reflections.getFieldsAnnotatedWith(Autowired.class);
      int methodCounter = 0;
      for (Iterator<Field> iterator2 = fields.iterator(); iterator2.hasNext();) {
        Field mField = (Field) iterator2.next();
        CtClass cls = cp.get(mField.getType().getName());
        String pckgName = cls.getPackageName();
View Full Code Here

            jarURLs.add(jar.toURI().toURL());
        }

        // Scan classes and all jars
        final List<String> candidates = new ArrayList<String>();
        new Reflections(new ConfigurationBuilder().
                addUrls(jarURLs).setScanners(new AbstractScanner() {
            @Override
            public void scan(Object cls) {
                if ((cls instanceof ClassFile)) {
                    ClassFile classFile = (ClassFile) cls;
View Full Code Here

TOP

Related Classes of org.reflections.reflections$TestModel$Usage$C2$fields

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.