Examples of AnnotationDB


Examples of org.scannotation.AnnotationDB

    {
        try
        {
            if (annotationDB == null)
            {
                annotationDB = new AnnotationDB();
                annotationDB.setScanClassAnnotations(true);
                annotationDB.crossReferenceMetaAnnotations();   
                annotationDB.setScanFieldAnnotations(false);
                annotationDB.setScanMethodAnnotations(false);
                annotationDB.setScanParameterAnnotations(false);
View Full Code Here

Examples of org.scannotation.AnnotationDB

    {
        try
        {
            if (annotationDB == null)
            {
                annotationDB = new AnnotationDB();
                annotationDB.setScanClassAnnotations(true);
                annotationDB.crossReferenceMetaAnnotations();   
                annotationDB.setScanFieldAnnotations(false);
                annotationDB.setScanMethodAnnotations(false);
                annotationDB.setScanParameterAnnotations(false);
View Full Code Here

Examples of org.scannotation.AnnotationDB

    {
        try
        {
            if (annotationDB == null)
            {
                annotationDB = new AnnotationDB();
                annotationDB.setScanClassAnnotations(true);
                annotationDB.crossReferenceMetaAnnotations();   
                annotationDB.setScanFieldAnnotations(false);
                annotationDB.setScanMethodAnnotations(false);
                annotationDB.setScanParameterAnnotations(false);
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 (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

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 (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) {
    try {
      AnnotationDB db = createAnnotationDB();

      for (String basePackage : basePackages) {
        String resource = basePackage.replace('.', '/');
        Enumeration<URL> urls = Thread.currentThread().getContextClassLoader().getResources(resource);
        if (!urls.hasMoreElements()) {
          logger.error("There's no occurence of package {} in classpath", basePackage);
          continue;
        }
        do {
          URL url = urls.nextElement();

          String file = url.getFile();
          file = file.substring(0, file.length() - resource.length() - 1);
          if (file.charAt(file.length() - 1) == '!') {
            file = file.substring(0, file.length() - 1);
          }
          if (!file.startsWith("file:")) {
            file = "file:" + file;
          }

          db.scanArchives(new URL(file));
        } while (urls.hasMoreElements());
      }

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

*/
public class AnnotationTests {
    @Test
    public void findAnnotations() throws IOException {
        URL[] urls = ClasspathUrlFinder.findClassPaths(); // scan java.class.path
        AnnotationDB db = new AnnotationDB();
        db.scanArchives(urls);
        Set<String> entities = db.getAnnotationIndex().get(Entity.class.getName());
        for (String entity : entities) {
            System.out.println("entity=" + entity);
        }
    }
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.