Package org.springframework.core.type.filter

Examples of org.springframework.core.type.filter.AnnotationTypeFilter


    }

    @SuppressWarnings("unchecked")
    private <T> void collect(Set<Class<T>>candidates, Class<?> clazz, String pkg) throws ClassNotFoundException {
      scanner.resetFilters(false);
        scanner.addIncludeFilter(clazz.isAnnotation() new AnnotationTypeFilter((Class<? extends Annotation>) clazz) : new AssignableTypeFilter(clazz));
        if (logger.isInfoEnabled()) logger.info("Scanning classpath [" + pkg + "] looking for " + (clazz.isAnnotation() ? "@" + clazz.getSimpleName() + " annotated" : clazz.getSimpleName()) + " domain entities");
        Set<BeanDefinition> definitions = scanner.findCandidateComponents(pkg);
        for (BeanDefinition def : definitions) {
          if (logger.isDebugEnabled()) logger.debug("Found matching class [" + def.getBeanClassName() + "]");
            candidates.add(ClassUtils.forName(def.getBeanClassName()));
View Full Code Here


        case ANNOTATION:
          Assert.isAssignable(Annotation.class, filterClass, "An error occured when processing a @ComponentScan "
              + "ANNOTATION type filter: ");
          @SuppressWarnings("unchecked")
          Class<Annotation> annoClass = (Class<Annotation>) filterClass;
          typeFilters.add(new AnnotationTypeFilter(annoClass));
          break;
        case ASSIGNABLE_TYPE:
          typeFilters.add(new AssignableTypeFilter(filterClass));
          break;
        case CUSTOM:
View Full Code Here

      for (TypeFilter filter : includeFilters) {
        addIncludeFilter(filter);
      }
    } else {
      super.addIncludeFilter(new InterfaceTypeFilter(Repository.class));
      super.addIncludeFilter(new AnnotationTypeFilter(RepositoryDefinition.class, true, true));
    }

    addExcludeFilter(new AnnotationTypeFilter(NoRepositoryBean.class));
  }
View Full Code Here

    super.addIncludeFilter(new AllTypeFilter(filterPlusInterface));

    List<TypeFilter> filterPlusAnnotation = new ArrayList<TypeFilter>(2);
    filterPlusAnnotation.add(includeFilter);
    filterPlusAnnotation.add(new AnnotationTypeFilter(RepositoryDefinition.class, true, true));

    super.addIncludeFilter(new AllTypeFilter(filterPlusAnnotation));
  }
View Full Code Here

  public Set<Class<?>> findTypes(Iterable<String> basePackages) {

    ClassPathScanningCandidateComponentProvider provider = new InterfaceAwareScanner(considerInterfaces);

    for (Class<? extends Annotation> annotationType : annotationTypess) {
      provider.addIncludeFilter(new AnnotationTypeFilter(annotationType, true, considerInterfaces));
    }

    Set<Class<?>> types = new HashSet<Class<?>>();

    for (String basePackage : basePackages) {
View Full Code Here

    String basePackage = getMappingBasePackage();
    Set<Class<?>> initialEntitySet = new HashSet<Class<?>>();

    if (StringUtils.hasText(basePackage)) {
      ClassPathScanningCandidateComponentProvider componentProvider = new ClassPathScanningCandidateComponentProvider(false);
      componentProvider.addIncludeFilter(new AnnotationTypeFilter(Document.class));
      componentProvider.addIncludeFilter(new AnnotationTypeFilter(Persistent.class));
      for (BeanDefinition candidate : componentProvider.findCandidateComponents(basePackage)) {
        initialEntitySet.add(ClassUtils.forName(candidate.getBeanClassName(), AbstractCouchbaseConfiguration.class.getClassLoader()));
      }
    }
View Full Code Here

        protected void registerDefaultFilters() {
            boolean acceptAllInterfaces = true;

            // if specified, use the given annotation and / or marker interface
            if (MapperScannerConfigurer.this.annotationClass != null) {
                addIncludeFilter(new AnnotationTypeFilter(MapperScannerConfigurer.this.annotationClass));
                acceptAllInterfaces = false;
            }

            // override AssignableTypeFilter to ignore matches on the actual marker interface
            if (MapperScannerConfigurer.this.markerInterface != null) {
View Full Code Here

  public void registerFilters() {
    boolean acceptAllInterfaces = true;

    // if specified, use the given annotation and / or marker interface
    if (this.annotationClass != null) {
      addIncludeFilter(new AnnotationTypeFilter(this.annotationClass));
      acceptAllInterfaces = false;
    }

    // override AssignableTypeFilter to ignore matches on the actual marker interface
    if (this.markerInterface != null) {
View Full Code Here

        for (String basePackage : basePackages) {
            if (this.logger.isInfoEnabled()) {
                this.logger.info("Scanning package [" + basePackage + "]");
            }
            ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider(false);
            scanner.addIncludeFilter(new AnnotationTypeFilter(com.googlecode.objectify.annotation.Entity.class));
            scanner.addIncludeFilter(new AnnotationTypeFilter(javax.persistence.Entity.class));
            Set<BeanDefinition> candidates = scanner.findCandidateComponents(basePackage);
            for (BeanDefinition candidate : candidates) {
                Class<?> clazz = ClassUtils.resolveClassName(candidate.getBeanClassName(), ClassUtils.getDefaultClassLoader());
                classes.add(clazz);
            }           
View Full Code Here

  private static Logger logger = LoggerFactory.getLogger(AnnotationScanner.class);

  public Set<Class<?>> scan(String packageRoot, Class<? extends Annotation> anno) {
    ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider(false);

    AnnotationTypeFilter filter = new AnnotationTypeFilter(anno);
    scanner.addIncludeFilter(filter);
    Set<BeanDefinition> beanSet = scanner.findCandidateComponents(packageRoot);

    Set<Class<?>> classSet = new HashSet<Class<?>>();
    for (BeanDefinition beanDef : beanSet) {
View Full Code Here

TOP

Related Classes of org.springframework.core.type.filter.AnnotationTypeFilter

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.