Package org.springframework.core.type.classreading

Examples of org.springframework.core.type.classreading.MetadataReader


      Class<?> beanClass = ((AbstractBeanDefinition) beanDef).getBeanClass();
      metadata = new StandardAnnotationMetadata(beanClass, true);
    }
    else {
      try {
        MetadataReader metadataReader = metadataReaderFactory.getMetadataReader(className);
        metadata = metadataReader.getAnnotationMetadata();
      }
      catch (IOException ex) {
        if (logger.isDebugEnabled()) {
          logger.debug("Could not find class file for introspecting configuration annotations: " + className, ex);
        }
View Full Code Here


    }
    processDeferredImportSelectors();
  }

  protected final void parse(String className, String beanName) throws IOException {
    MetadataReader reader = this.metadataReaderFactory.getMetadataReader(className);
    processConfigurationClass(new ConfigurationClass(reader, beanName));
  }
View Full Code Here

          sourceToProcess = metadataReaderFactory.getMetadataReader(sourceClass.getName());
        }
      }

      // ASM-based resolution - safe for non-resolvable classes as well
      MetadataReader sourceReader = (MetadataReader) sourceToProcess;
      String[] memberClassNames = sourceReader.getClassMetadata().getMemberClassNames();
      List<SourceClass> members = new ArrayList<SourceClass>(memberClassNames.length);
      for (String memberClassName : memberClassNames) {
        members.add(asSourceClass(memberClassName));
      }
      return members;
View Full Code Here

              ClassUtils.convertClassNameToResourcePath(pkg) + CLASS_RESOURCE_PATTERN;
          Resource[] resources = this.resourcePatternResolver.getResources(pattern);
          MetadataReaderFactory readerFactory = new CachingMetadataReaderFactory(this.resourcePatternResolver);
          for (Resource resource : resources) {
            if (resource.isReadable()) {
              MetadataReader reader = readerFactory.getMetadataReader(resource);
              String className = reader.getClassMetadata().getClassName();
              if (matchesFilter(reader, readerFactory)) {
                scannedUnit.addManagedClassName(className);
                if (scannedUnit.getPersistenceUnitRootUrl() == null) {
                  URL url = resource.getURL();
                  if (ResourceUtils.isJarURL(url)) {
View Full Code Here

            ClassUtils.convertClassNameToResourcePath(pkg) + RESOURCE_PATTERN;
        Resource[] resources = this.resourcePatternResolver.getResources(pattern);
        MetadataReaderFactory readerFactory = new CachingMetadataReaderFactory(this.resourcePatternResolver);
        for (Resource resource : resources) {
          if (resource.isReadable()) {
            MetadataReader reader = readerFactory.getMetadataReader(resource);
            String className = reader.getClassMetadata().getClassName();
            if (matchesEntityTypeFilter(reader, readerFactory)) {
              entityClassNames.add(className);
            }
            else if (converterTypeFilter != null && converterTypeFilter.match(reader, readerFactory)) {
              converterClassNames.add(className);
View Full Code Here

              ClassUtils.convertClassNameToResourcePath(pkg) + RESOURCE_PATTERN;
          Resource[] resources = this.resourcePatternResolver.getResources(pattern);
          MetadataReaderFactory readerFactory = new CachingMetadataReaderFactory(this.resourcePatternResolver);
          for (Resource resource : resources) {
            if (resource.isReadable()) {
              MetadataReader reader = readerFactory.getMetadataReader(resource);
              String className = reader.getClassMetadata().getClassName();
              if (matchesEntityTypeFilter(reader, readerFactory)) {
                classNames.add(className);
              }
              else if (className.endsWith(PACKAGE_INFO_SUFFIX)) {
                packageNames.add(className.substring(0, className.length() - PACKAGE_INFO_SUFFIX.length()));
View Full Code Here

        public int hashCode() {
          return System.identityHashCode(this);
        }
      };

      MetadataReader reader = mrf.getMetadataReader(resource);
      assertThat(reader, notNullValue());
    }

    // useful for profiling to take snapshots
    // System.in.read();
View Full Code Here

  @Test
  public void testDirectAnnotationMatch() throws Exception {
    MetadataReaderFactory metadataReaderFactory = new SimpleMetadataReaderFactory();
    String classUnderTest = "org.springframework.core.type.AnnotationTypeFilterTests$SomeComponent";
    MetadataReader metadataReader = metadataReaderFactory.getMetadataReader(classUnderTest);

    AnnotationTypeFilter filter = new AnnotationTypeFilter(InheritedAnnotation.class);
    assertTrue(filter.match(metadataReader, metadataReaderFactory));
    ClassloadingAssertions.assertClassNotLoaded(classUnderTest);
  }
View Full Code Here

  @Test
  public void testInheritedAnnotationFromInterfaceDoesNotMatch() throws Exception {
    MetadataReaderFactory metadataReaderFactory = new SimpleMetadataReaderFactory();
    String classUnderTest = "org.springframework.core.type.AnnotationTypeFilterTests$SomeSubClassOfSomeComponentInterface";
    MetadataReader metadataReader = metadataReaderFactory.getMetadataReader(classUnderTest);

    AnnotationTypeFilter filter = new AnnotationTypeFilter(InheritedAnnotation.class);
    // Must fail as annotation on interfaces should not be considered a match
    assertFalse(filter.match(metadataReader, metadataReaderFactory));
    ClassloadingAssertions.assertClassNotLoaded(classUnderTest);
View Full Code Here

  @Test
  public void testInheritedAnnotationFromBaseClassDoesMatch() throws Exception {
    MetadataReaderFactory metadataReaderFactory = new SimpleMetadataReaderFactory();
    String classUnderTest = "org.springframework.core.type.AnnotationTypeFilterTests$SomeSubClassOfSomeComponent";
    MetadataReader metadataReader = metadataReaderFactory.getMetadataReader(classUnderTest);

    AnnotationTypeFilter filter = new AnnotationTypeFilter(InheritedAnnotation.class);
    assertTrue(filter.match(metadataReader, metadataReaderFactory));
    ClassloadingAssertions.assertClassNotLoaded(classUnderTest);
  }
View Full Code Here

TOP

Related Classes of org.springframework.core.type.classreading.MetadataReader

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.