Examples of AnnotationMetadata


Examples of org.springframework.core.type.AnnotationMetadata

  ResourceLoader resourceLoader;

  @Before
  public void setUp() {

    AnnotationMetadata annotationMetadata = new StandardAnnotationMetadata(SampleConfiguration.class, true);
    environment = new StandardEnvironment();
    resourceLoader = new DefaultResourceLoader();
    source = new AnnotationRepositoryConfigurationSource(annotationMetadata, EnableRepositories.class, resourceLoader,
        environment);
  }
View Full Code Here

Examples of org.springframework.core.type.AnnotationMetadata

    assertThat(getConfigSource(DefaultConfiguration.class).usesExplicitFilters(), is(false));
  }

  private AnnotationRepositoryConfigurationSource getConfigSource(Class<?> type) {

    AnnotationMetadata metadata = new StandardAnnotationMetadata(type, true);
    return new AnnotationRepositoryConfigurationSource(metadata, EnableRepositories.class, resourceLoader, environment);
  }
View Full Code Here

Examples of org.springframework.core.type.AnnotationMetadata

  }

  @Test
  public void registersBeanDefinitionForFoundBean() {

    AnnotationMetadata metadata = new StandardAnnotationMetadata(SampleConfiguration.class, true);

    registrar.registerBeanDefinitions(metadata, registry);

    assertBeanDefinitionRegisteredFor("myRepository");
    assertNoBeanDefinitionRegisteredFor("profileRepository");
View Full Code Here

Examples of org.springframework.core.type.AnnotationMetadata

            final Resource[] resources = resolver.getResources(packageSearchPath);   
           
           
            for (final Resource resource: resources) {
                final MetadataReader reader = factory.getMetadataReader(resource);
                final AnnotationMetadata metadata = reader.getAnnotationMetadata();
               
                if (scanAllPackages && shouldSkip(metadata.getClassName())) {
                    continue;
                }
               
                for (Class< ? extends Annotation > annotation: annotations) {
                    boolean concreteClass = !metadata.isInterface() && !metadata.isAbstract();
                    if (metadata.isAnnotated(annotation.getName())) {
                        if (concreteClass) {
                            classes.get(annotation).add(
                                ClassLoaderUtils.loadClass(metadata.getClassName(), getClass()));
                        } else {
                            matchingInterfaces.get(annotation).add(metadata.getClassName());   
                        }
                    } else if (concreteClass && metadata.getInterfaceNames().length > 0) {
                        nonMatchingClasses.put(metadata.getClassName(), metadata.getInterfaceNames());
                    }
                }
            }
        }
        for (Map.Entry<Class<? extends Annotation>, Collection<String>> e1 : matchingInterfaces.entrySet()) {
View Full Code Here

Examples of org.springframework.core.type.AnnotationMetadata

  }


  @Override
  protected boolean matchSelf(MetadataReader metadataReader) {
    AnnotationMetadata metadata = metadataReader.getAnnotationMetadata();
    return metadata.hasAnnotation(this.annotationType.getName()) ||
        (this.considerMetaAnnotations && metadata.hasMetaAnnotation(this.annotationType.getName()));
  }
View Full Code Here

Examples of org.springframework.core.type.AnnotationMetadata

  }


  @Override
  protected boolean matchSelf(MetadataReader metadataReader) {
    AnnotationMetadata metadata = metadataReader.getAnnotationMetadata();
    return metadata.hasAnnotation(this.annotationType.getName()) ||
        (this.considerMetaAnnotations && metadata.hasMetaAnnotation(this.annotationType.getName()));
  }
View Full Code Here

Examples of org.springframework.core.type.AnnotationMetadata

        return false;
      }
    }
    for (TypeFilter tf : this.includeFilters) {
      if (tf.match(metadataReader, this.metadataReaderFactory)) {
        AnnotationMetadata metadata = metadataReader.getAnnotationMetadata();
        if (!ProfileHelper.isProfileAnnotationPresent(metadata)) {
          return true;
        }
        return this.environment.acceptsProfiles(ProfileHelper.getCandidateProfiles(metadata));
      }
View Full Code Here

Examples of org.springframework.core.type.AnnotationMetadata

      if (bean instanceof ImportAware) {
        ImportRegistry importRegistry = beanFactory.getBean(ImportRegistry.class);
        String importingClass = importRegistry.getImportingClassFor(bean.getClass().getSuperclass().getName());
        if (importingClass != null) {
          try {
            AnnotationMetadata metadata =
                new SimpleMetadataReaderFactory().getMetadataReader(importingClass).getAnnotationMetadata();
            ((ImportAware) bean).setImportMetadata(metadata);
          }
          catch (IOException ex) {
            // should never occur -> at this point we know the class is present anyway
View Full Code Here

Examples of org.springframework.core.type.AnnotationMetadata

  public void parse(Class<?> clazz, String beanName) throws IOException {
    processConfigurationClass(new ConfigurationClass(clazz, beanName));
  }

  protected void processConfigurationClass(ConfigurationClass configClass) throws IOException {
    AnnotationMetadata metadata = configClass.getMetadata();
    if (this.environment != null && ProfileHelper.isProfileAnnotationPresent(metadata)) {
      if (!this.environment.acceptsProfiles(ProfileHelper.getCandidateProfiles(metadata))) {
        return;
      }
    }

    while (metadata != null) {
      doProcessConfigurationClass(configClass, metadata);
      String superClassName = metadata.getSuperClassName();
      if (superClassName != null && !Object.class.getName().equals(superClassName)) {
        if (metadata instanceof StandardAnnotationMetadata) {
          Class<?> clazz = ((StandardAnnotationMetadata) metadata).getIntrospectedClass();
          metadata = new StandardAnnotationMetadata(clazz.getSuperclass());
        }
View Full Code Here

Examples of org.springframework.core.type.AnnotationMetadata

  protected void doProcessConfigurationClass(ConfigurationClass configClass, AnnotationMetadata metadata) throws IOException {

    // recursively process any member (nested) classes first
    for (String memberClassName : metadata.getMemberClassNames()) {
      MetadataReader reader = this.metadataReaderFactory.getMetadataReader(memberClassName);
      AnnotationMetadata memberClassMetadata = reader.getAnnotationMetadata();
      if (ConfigurationClassUtils.isConfigurationCandidate(memberClassMetadata)) {
        processConfigurationClass(new ConfigurationClass(reader, null));
      }
    }
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.