Package org.springframework.core.type.classreading

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


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

    AnnotationTypeFilter filter = new AnnotationTypeFilter(NonInheritedAnnotation.class);
    // Must fail as annotation isn't inherited
    assertFalse(filter.match(metadataReader, metadataReaderFactory));
    ClassloadingAssertions.assertClassNotLoaded(classUnderTest);
View Full Code Here


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

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

  @Test
  public void testMatchesInterfacesIfConfigured() throws Exception {

    MetadataReaderFactory metadataReaderFactory = new SimpleMetadataReaderFactory();
    String classUnderTest = "org.springframework.core.type.AnnotationTypeFilterTests$SomeComponentInterface";
    MetadataReader metadataReader = metadataReaderFactory.getMetadataReader(classUnderTest);

    AnnotationTypeFilter filter = new AnnotationTypeFilter(InheritedAnnotation.class, false, true);

    assertTrue(filter.match(metadataReader, metadataReaderFactory));
    ClassloadingAssertions.assertClassNotLoaded(classUnderTest);
View Full Code Here

  }

  @Test
  public void asmAnnotationMetadata() throws Exception {
    MetadataReaderFactory metadataReaderFactory = new SimpleMetadataReaderFactory();
    MetadataReader metadataReader = metadataReaderFactory.getMetadataReader(AnnotatedComponent.class.getName());
    AnnotationMetadata metadata = metadataReader.getAnnotationMetadata();
    doTestAnnotationInfo(metadata);
    doTestMethodAnnotationInfo(metadata);
  }
View Full Code Here

  }

  @Test
  public void asmAnnotationMetadataForSubclass() throws Exception {
    MetadataReaderFactory metadataReaderFactory = new SimpleMetadataReaderFactory();
    MetadataReader metadataReader = metadataReaderFactory.getMetadataReader(AnnotatedComponentSubClass.class.getName());
    AnnotationMetadata metadata = metadataReader.getAnnotationMetadata();
    doTestSubClassAnnotationInfo(metadata);
  }
View Full Code Here

  }

  @Test
  public void asmAnnotationMetadataForInterface() throws Exception {
    MetadataReaderFactory metadataReaderFactory = new SimpleMetadataReaderFactory();
    MetadataReader metadataReader = metadataReaderFactory.getMetadataReader(AnnotationMetadata.class.getName());
    AnnotationMetadata metadata = metadataReader.getAnnotationMetadata();
    doTestMetadataForInterfaceClass(metadata);
  }
View Full Code Here

  }

  @Test
  public void asmAnnotationMetadataForAnnotation() throws Exception {
    MetadataReaderFactory metadataReaderFactory = new SimpleMetadataReaderFactory();
    MetadataReader metadataReader = metadataReaderFactory.getMetadataReader(Component.class.getName());
    AnnotationMetadata metadata = metadataReader.getAnnotationMetadata();
    doTestMetadataForAnnotationClass(metadata);
  }
View Full Code Here

  }

  @Test
  public void metaAnnotationOverridesUsingAnnotationMetadataReadingVisitor() throws Exception {
    MetadataReaderFactory metadataReaderFactory = new SimpleMetadataReaderFactory();
    MetadataReader metadataReader = metadataReaderFactory.getMetadataReader(ComposedConfigurationWithAttributeOverridesClass.class.getName());
    AnnotationMetadata metadata = metadataReader.getAnnotationMetadata();
    assertMetaAnnotationOverrides(metadata);
  }
View Full Code Here

   * https://jira.spring.io/browse/SPR-11649
   */
  @Test
  public void multipleAnnotationsWithIdenticalAttributeNamesUsingAnnotationMetadataReadingVisitor() throws Exception {
    MetadataReaderFactory metadataReaderFactory = new SimpleMetadataReaderFactory();
    MetadataReader metadataReader = metadataReaderFactory.getMetadataReader(NamedAnnotationsClass.class.getName());
    AnnotationMetadata metadata = metadataReader.getAnnotationMetadata();
    assertMultipleAnnotationsWithIdenticalAttributeNames(metadata);
  }
View Full Code Here

   * https://jira.spring.io/browse/SPR-11649
   */
  @Test
  public void composedAnnotationWithMetaAnnotationsWithIdenticalAttributeNamesUsingAnnotationMetadataReadingVisitor() throws Exception {
    MetadataReaderFactory metadataReaderFactory = new SimpleMetadataReaderFactory();
    MetadataReader metadataReader = metadataReaderFactory.getMetadataReader(NamedComposedAnnotationClass.class.getName());
    AnnotationMetadata metadata = metadataReader.getAnnotationMetadata();
    assertMultipleAnnotationsWithIdenticalAttributeNames(metadata);
  }
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.