Examples of AnnotationTypeFilter


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

        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

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

  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

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

          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

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

   * JSR-330's {@link javax.inject.Named} annotations, if available.
   *
   */
  @SuppressWarnings("unchecked")
  protected void registerDefaultFilters() {
    this.includeFilters.add(new AnnotationTypeFilter(Component.class));
    ClassLoader cl = ClassPathScanningCandidateComponentProvider.class.getClassLoader();
    try {
      this.includeFilters.add(new AnnotationTypeFilter(
          ((Class<? extends Annotation>) cl.loadClass("javax.annotation.ManagedBean")), false));
      logger.info("JSR-250 'javax.annotation.ManagedBean' found and supported for component scanning");
    }
    catch (ClassNotFoundException ex) {
      // JSR-250 1.1 API (as included in Java EE 6) not available - simply skip.
    }
    try {
      this.includeFilters.add(new AnnotationTypeFilter(
          ((Class<? extends Annotation>) cl.loadClass("javax.inject.Named")), false));
      logger.info("JSR-330 'javax.inject.Named' annotation found and supported for component scanning");
    }
    catch (ClassNotFoundException ex) {
      // JSR-330 API not available - simply skip.
View Full Code Here

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

          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

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

  protected TypeFilter createTypeFilter(Element element, ClassLoader classLoader) {
    String filterType = element.getAttribute(FILTER_TYPE_ATTRIBUTE);
    String expression = element.getAttribute(FILTER_EXPRESSION_ATTRIBUTE);
    try {
      if ("annotation".equals(filterType)) {
        return new AnnotationTypeFilter((Class<Annotation>) classLoader.loadClass(expression));
      }
      else if ("assignable".equals(filterType)) {
        return new AssignableTypeFilter(classLoader.loadClass(expression));
      }
      else if ("aspectj".equals(filterType)) {
View Full Code Here

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

   * JSR-330's {@link javax.inject.Named} annotations, if available.
   *
   */
  @SuppressWarnings("unchecked")
  protected void registerDefaultFilters() {
    this.includeFilters.add(new AnnotationTypeFilter(Component.class));
    ClassLoader cl = ClassPathScanningCandidateComponentProvider.class.getClassLoader();
    try {
      this.includeFilters.add(new AnnotationTypeFilter(
          ((Class<? extends Annotation>) cl.loadClass("javax.annotation.ManagedBean")), false));
      logger.info("JSR-250 'javax.annotation.ManagedBean' found and supported for component scanning");
    }
    catch (ClassNotFoundException ex) {
      // JSR-250 1.1 API (as included in Java EE 6) not available - simply skip.
    }
    try {
      this.includeFilters.add(new AnnotationTypeFilter(
          ((Class<? extends Annotation>) cl.loadClass("javax.inject.Named")), false));
      logger.info("JSR-330 'javax.inject.Named' annotation found and supported for component scanning");
    }
    catch (ClassNotFoundException ex) {
      // JSR-330 API not available - simply skip.
View Full Code Here

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

   * {@link Component @Component} meta-annotation including the
   * {@link Repository @Repository}, {@link Service @Service}, and
   * {@link Controller @Controller} stereotype annotations.
   */
  protected void registerDefaultFilters() {
    this.includeFilters.add(new AnnotationTypeFilter(Component.class));
  }
View Full Code Here

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

  private TypeFilter createTypeFilter(Element element, ClassLoader classLoader) {
    String filterType = element.getAttribute(FILTER_TYPE_ATTRIBUTE);
    String expression = element.getAttribute(FILTER_EXPRESSION_ATTRIBUTE);
    try {
      if ("annotation".equals(filterType)) {
        return new AnnotationTypeFilter((Class<Annotation>) classLoader.loadClass(expression));
      }
      else if ("assignable".equals(filterType)) {
        return new AssignableTypeFilter(classLoader.loadClass(expression));
      }
      else if ("regex".equals(filterType)) {
View Full Code Here

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

  protected TypeFilter createTypeFilter(Element element, ClassLoader classLoader) {
    String filterType = element.getAttribute(FILTER_TYPE_ATTRIBUTE);
    String expression = element.getAttribute(FILTER_EXPRESSION_ATTRIBUTE);
    try {
      if ("annotation".equals(filterType)) {
        return new AnnotationTypeFilter((Class<Annotation>) classLoader.loadClass(expression));
      }
      else if ("assignable".equals(filterType)) {
        return new AssignableTypeFilter(classLoader.loadClass(expression));
      }
      else if ("aspectj".equals(filterType)) {
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.