Package org.scannotation

Examples of org.scannotation.AnnotationDB


    private ClassLoader classLoader;

    public ApplicationMetaData(ClassLoader classLoader) throws IOException, JobStartException {
        this.classLoader = classLoader;
        annotationDB = new AnnotationDB();
        annotationDB.addIgnoredPackages(ignoredPkgs);
        URL[] urls = ClasspathUrlFinder.findClassPaths();
//        System.out.println("classpath urls: ");
//        for (URL u : urls) {
//            System.out.println(u);
View Full Code Here


                logger.fine("classpath urls:");
                for (URL url : urls) {
                    logger.fine(url.toString());
                }
            }
            AnnotationDB annotationDB = new AnnotationDB();
            annotationDB.scanArchives(urls);
            entities = annotationDB.getAnnotationIndex().get(Entity.class.getName());
            if (entities != null) {
                for (String entity : entities) {
                    initEntity(entity);
                }
            }
View Full Code Here

      throw new TypeException("no such class " + c, e);
    }
  }

  private void importLibs(final List<URL> urls) throws IOException {
    final AnnotationDB db = new AnnotationDB();
    db.setScanMethodAnnotations(true);
    db.setScanClassAnnotations(true);

    // let's assume the entire runtime is in the same classpath entry as the
    // int sum aggregator
    db.scanArchives(ClasspathUrlFinder.findClassBase(IntSumAggregator.class));

    for (final URL s : ClasspathUrlFinder.findClassPaths())
      if (s.getPath().endsWith("/"))
        db.scanArchives(s);

    for (final URL url : urls)
      db.scanArchives(url);

    final Map<String, Set<String>> annotationIndex = db.getAnnotationIndex();

    for (final String c : annotationIndex.get(AggregatorSpec.class.getCanonicalName()))
      try {
        this.importAggregator(c);
      } catch (final NoClassDefFoundError e) {
View Full Code Here

        return results;
    }

    private Map<String, Set<String>> scanWebInfClasses(URL webInfClasses) {
        try {
            AnnotationDB db = createAnnotationDB();
            db.scanArchives(webInfClasses);
            return db.getAnnotationIndex();
        } catch (FileNotFoundException e) {
            return Collections.emptyMap();
        } catch (IOException e) {
            throw new ScannerException("Could not scan WEB-INF/classes", e);
        }
View Full Code Here

        }
    }

    private Map<String, Set<String>> scanBasePackages(List<String> basePackages, ClasspathResolver resolver) {
        try {
            AnnotationDB db = createAnnotationDB();

            for (String basePackage : basePackages) {
                scanPackage(basePackage, db, resolver);
            }

            return db.getAnnotationIndex();
        } catch (IOException e) {
            throw new ScannerException("Could not scan base packages", e);
        }
    }
View Full Code Here

    private <T> Set<T> nullToEmpty(Set<T> set) {
        return firstNonNull(set, Collections.<T>emptySet());
    }

    private AnnotationDB createAnnotationDB() {
        AnnotationDB db = new AnnotationDB();
        db.setScanClassAnnotations(true);
        db.setScanFieldAnnotations(false);
        db.setScanMethodAnnotations(false);
        db.setScanParameterAnnotations(false);
        return db;
    }
View Full Code Here

TOP

Related Classes of org.scannotation.AnnotationDB

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.