Package org.scannotation

Examples of org.scannotation.AnnotationDB


    for(URL url : urls) {
      System.out.println(url.toString());
        System.out.println("URL is : [" + url.getPath() + "] with protocol: [" + url.getProtocol() + "]");
        System.out.println(url.getFile());
      }
    AnnotationDB db = new AnnotationDB();
      db.scanArchives(urls);
      Set<String> entityClasses = db.getAnnotationIndex().get(javax.persistence.Entity.class.getName());
      System.out.println(entityClasses);
  }
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

    return results;
  }

  private Map<String, Set<String>> scanWebInfClasses(URL webInfClasses) {
    try {
      AnnotationDB db = createAnnotationDB();
      db.scanArchives(webInfClasses);
      return db.getAnnotationIndex();
    } 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) {
    try {
      AnnotationDB db = createAnnotationDB();

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

      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

                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

         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

      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

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.