Examples of AnnotationDB


Examples of org.scannotation.AnnotationDB

  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

Examples of org.scannotation.AnnotationDB

                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

Examples of org.scannotation.AnnotationDB

         if (applicationConfig != null)
            throw new RuntimeException("You cannot deploy a javax.ws.rs.core.Application and have scanning on as this may create errors");

         URL[] urls = WarUrlFinder.findWebInfLibClasspaths(event);
         URL url = WarUrlFinder.findWebInfClassesPath(event);
         AnnotationDB db = new AnnotationDB();
         String[] ignoredPackages = {"org.jboss.resteasy.plugins", "org.jboss.resteasy.annotations", "org.jboss.resteasy.client", "org.jboss.resteasy.specimpl", "org.jboss.resteasy.core", "org.jboss.resteasy.spi", "org.jboss.resteasy.util", "org.jboss.resteasy.mock", "javax.ws.rs"};
         db.setIgnoredPackages(ignoredPackages);
         try
         {
            if (url != null) db.scanArchives(url);
            db.scanArchives(urls);
            try
            {
               db.crossReferenceImplementedInterfaces();
               db.crossReferenceMetaAnnotations();
            }
            catch (AnnotationDB.CrossReferenceException ignored)
            {

            }
View Full Code Here

Examples of org.scannotation.AnnotationDB

      URL jarUrl = FileLocator.toFileURL(
          FileLocator.find(bundle, new Path(jarName), null));

      logger.debug("{}: loading commands", name);

      AnnotationDB db = new AnnotationDB();
      db.setScanClassAnnotations(true);
      db.setScanFieldAnnotations(false);
      db.setScanMethodAnnotations(false);
      db.setScanParameterAnnotations(false);
      db.scanArchives(jarUrl);
      Set<String> commandClasses = db.getAnnotationIndex()
        .get(org.eclim.annotation.Command.class.getName());
      if(commandClasses != null){
        for (String commandClass : commandClasses){
          logger.debug("{}: loading command: {}", name, commandClass);
          @SuppressWarnings("unchecked")
View Full Code Here

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

Examples of org.scannotation.AnnotationDB

                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

Examples of org.scannotation.AnnotationDB

      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

Examples of org.scannotation.AnnotationDB

        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

Examples of org.scannotation.AnnotationDB

        }
    }

    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

Examples of org.scannotation.AnnotationDB

    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
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.