Package org.reflections.scanners

Examples of org.reflections.scanners.TypeAnnotationsScanner


            {
                filterInputsBy(filter);
                setUrls(ClasspathHelper.getUrlsForPackagePrefix(prefix));
                if (scanners == null || scanners.length == 0) {
                    setScanners(
                            new TypeAnnotationsScanner().filterResultsBy(filter),
                            new SubTypesScanner().filterResultsBy(filter));
                } else {
                    setScanners(scanners);
                }
            }
View Full Code Here


  private Map<Class<?>, ModelMetadata> scan(ClassLoader... classloaders) {
    Map<Class<?>, ModelMetadata> map = Maps.newHashMap();

    final Reflections reflections = new Reflections(new ConfigurationBuilder().setUrls(
        ClasspathHelper.forPackage("", classloaders)).setScanners(new SubTypesScanner(),
        new TypeAnnotationsScanner()).addClassLoaders(classloaders));

    Set<Class<?>> entities = reflections.getTypesAnnotatedWith(Entity.class);
    for (Class<?> entity : entities) {
      ModelMetadata metadata = getMetadata(entity);
      map.put(entity, metadata);
View Full Code Here

  @SuppressWarnings({ "rawtypes", "unchecked" })
  private <C extends CRUD> Map<Class<?>, ControllerProxy<?, ?>> scanRest(GlobalSettings global, Class<C> superType, ClassLoader... cls) {
    final Reflections reflections = new Reflections(new ConfigurationBuilder().setUrls(
        ClasspathHelper.forPackage("", cls)).setScanners(new SubTypesScanner(),
        new TypeAnnotationsScanner()).addClassLoaders(cls));

    Map<Class<?>, ControllerProxy<?, ?>> map = Maps.newHashMap();
    Set<Class<? extends C>> controllerClasses = reflections.getSubTypesOf(superType);
    for (Class<? extends C> controllerClass : controllerClasses) {
      try {
View Full Code Here

  @SuppressWarnings({ "rawtypes", "unchecked" })
  private <C extends CRUD> Map<Class<?>, ControllerProxyCRUD<?, ?>> scanCrud(GlobalSettings global, Class<C> superType, ClassLoader... cls) {
    final Reflections reflections = new Reflections(new ConfigurationBuilder().setUrls(
        ClasspathHelper.forPackage("", cls)).setScanners(new SubTypesScanner(),
        new TypeAnnotationsScanner()).addClassLoaders(cls));

    Map<Class<?>, ControllerProxyCRUD<?, ?>> map = Maps.newHashMap();
    Set<Class<? extends C>> controllerClasses = reflections.getSubTypesOf(superType);
    for (Class<? extends C> controllerClass : controllerClasses) {
      try {
View Full Code Here

   */
  public static Set<String> scan(URL[] classpathUrls, String annotationClassName) {
    ArgumentChecker.notNull(annotationClassName, "annotationClassName");
    Set<URL> urls = new HashSet<>(Arrays.asList(classpathUrls));
    AnnotationReflector reflector = new AnnotationReflector(
        null, urls, new TypeAnnotationsScanner(),
        ClassNameAnnotationScannerUtils.class.getClassLoader(), Thread.currentThread().getContextClassLoader());
    Set<String> classNames = reflector.getReflector().getStore().getTypesAnnotatedWith(annotationClassName);
    if (classNames == null) {
      return Collections.emptySet();
    }
View Full Code Here

      scanners++;
    }
    final Object[] config = new Object[scanners + 2];
    scanners = 0;
    if (isScanClassAnnotations()) {
      config[scanners++] = new TypeAnnotationsScanner();
    }
    if (isScanFieldAnnotations()) {
      config[scanners++] = new FieldAnnotationsScanner();
    }
    if (isScanMethodAnnotations()) {
View Full Code Here

      } catch (Exception ex) {
        // ignore
      }
      Configuration config = new ConfigurationBuilder()
        .setUrls(ClasspathHelper.forManifest(ClasspathHelper.forJavaClassPath()))
        .setScanners(new TypeAnnotationsScanner(), new FieldAnnotationsScanner(), new SubTypesScanner(false))
        .filterInputsBy(FilterBuilder.parse(AnnotationReflector.DEFAULT_ANNOTATION_REFLECTOR_FILTER))
        .addClassLoaders(loaders)
        .useParallelExecutor();
      AnnotationReflector.initDefaultReflector(new AnnotationReflector(config));
      AnnotationReflector reflector = AnnotationReflector.getDefaultReflector();
View Full Code Here

    /*lazy*/ private Serializer serializer;
    @Nullable private ExecutorService executorService;
    @Nullable private ClassLoader[] classLoaders;

    public ConfigurationBuilder() {
        scanners = Sets.<Scanner>newHashSet(new TypeAnnotationsScanner(), new SubTypesScanner());
        urls = Sets.newHashSet();
    }
View Full Code Here

        //
        Reflections reflections = new Reflections(new ConfigurationBuilder()
                .filterInputsBy(filter)
                .setScanners(new SubTypesScanner().filterResultsBy(filter),
                        new TypeAnnotationsScanner().filterResultsBy(filter),
                        new FieldAnnotationsScanner().filterResultsBy(filter),
                        new MethodAnnotationsScanner().filterResultsBy(filter),
                        new MethodParameterScanner())
                .setUrls(ClasspathHelper.forPackage(packName)));
View Full Code Here

    if (localPredicate == null) {
      localPredicate = Predicates.alwaysTrue();
    }
    Assert.parametersNotNull("m, predicate", m, localPredicate);
    final ConfigurationBuilder conf = new ConfigurationBuilder();
    conf.setScanners(new TypesScanner(), new TypeAnnotationsScanner());

    final Set<URL> s = new HashSet<URL>();
    s.addAll(ClasspathHelper.forClassLoader());
    s.addAll(Arrays.asList(ClasspathUrlFinder.findClassPaths()));
    final Iterator<URL> iterator = s.iterator();
View Full Code Here

TOP

Related Classes of org.reflections.scanners.TypeAnnotationsScanner

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.