Examples of SimpleMetadataReaderFactory


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

    assertNoMatch("org.springframework.core.type.AspectJTypeFilterTests$SomeClass",
        "*..Bogus && org.springframework.core.type.AspectJTypeFilterTests.SomeClass");
  }

  private void assertMatch(String type, String typePattern) throws Exception {
    MetadataReaderFactory metadataReaderFactory = new SimpleMetadataReaderFactory();
    MetadataReader metadataReader = metadataReaderFactory.getMetadataReader(type);

    AspectJTypeFilter filter = new AspectJTypeFilter(typePattern, getClass().getClassLoader());
    assertTrue(filter.match(metadataReader, metadataReaderFactory));
    ClassloadingAssertions.assertClassNotLoaded(type);
  }
View Full Code Here

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

    assertTrue(filter.match(metadataReader, metadataReaderFactory));
    ClassloadingAssertions.assertClassNotLoaded(type);
  }

  private void assertNoMatch(String type, String typePattern) throws Exception {
    MetadataReaderFactory metadataReaderFactory = new SimpleMetadataReaderFactory();
    MetadataReader metadataReader = metadataReaderFactory.getMetadataReader(type);

    AspectJTypeFilter filter = new AspectJTypeFilter(typePattern, getClass().getClassLoader());
    assertFalse(filter.match(metadataReader, metadataReaderFactory));
    ClassloadingAssertions.assertClassNotLoaded(type);
  }
View Full Code Here

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

* @author Juergen Hoeller
*/
public class AssignableTypeFilterTests extends TestCase {

  public void testDirectMatch() throws Exception {
    MetadataReaderFactory metadataReaderFactory = new SimpleMetadataReaderFactory();
    String classUnderTest = "org.springframework.core.type.AssignableTypeFilterTests$TestNonInheritingClass";
    MetadataReader metadataReader = metadataReaderFactory.getMetadataReader(classUnderTest);

    AssignableTypeFilter matchingFilter = new AssignableTypeFilter(TestNonInheritingClass.class);
    AssignableTypeFilter notMatchingFilter = new AssignableTypeFilter(TestInterface.class);
    assertFalse(notMatchingFilter.match(metadataReader, metadataReaderFactory));
    assertTrue(matchingFilter.match(metadataReader, metadataReaderFactory));
View Full Code Here

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

    assertFalse(notMatchingFilter.match(metadataReader, metadataReaderFactory));
    assertTrue(matchingFilter.match(metadataReader, metadataReaderFactory));
  }

  public void testInterfaceMatch() throws Exception {
    MetadataReaderFactory metadataReaderFactory = new SimpleMetadataReaderFactory();
    String classUnderTest = "org.springframework.core.type.AssignableTypeFilterTests$TestInterfaceImpl";
    MetadataReader metadataReader = metadataReaderFactory.getMetadataReader(classUnderTest);

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

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

    assertTrue(filter.match(metadataReader, metadataReaderFactory));
    ClassloadingAssertions.assertClassNotLoaded(classUnderTest);
  }

  public void testSuperClassMatch() throws Exception {
    MetadataReaderFactory metadataReaderFactory = new SimpleMetadataReaderFactory();
    String classUnderTest = "org.springframework.core.type.AssignableTypeFilterTests$SomeDaoLikeImpl";
    MetadataReader metadataReader = metadataReaderFactory.getMetadataReader(classUnderTest);

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

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

    assertTrue(filter.match(metadataReader, metadataReaderFactory));
    ClassloadingAssertions.assertClassNotLoaded(classUnderTest);
  }

  public void testInterfaceThroughSuperClassMatch() throws Exception {
    MetadataReaderFactory metadataReaderFactory = new SimpleMetadataReaderFactory();
    String classUnderTest = "org.springframework.core.type.AssignableTypeFilterTests$SomeDaoLikeImpl";
    MetadataReader metadataReader = metadataReaderFactory.getMetadataReader(classUnderTest);

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

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

    Resource[] resources = this.resolver.getResources("classpath*:"
        + getClass().getPackage().getName().replace(".", "/") + "/**/*.class");

    for (Resource resource : resources) {
      if (!isTestClass(resource)) {
        MetadataReader metadataReader = new SimpleMetadataReaderFactory()
            .getMetadataReader(resource);
        AnnotationMetadata annotationMetadata = metadataReader
            .getAnnotationMetadata();
        if (annotationMetadata.getAnnotationTypes().contains(
            Configuration.class.getName())) {
View Full Code Here

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

    private final Map<AnnotationMetadata, List<Condition>> memberConditions;

    public MemberConditions(ConditionContext context, String className) {
      this.context = context;
      this.readerFactory = new SimpleMetadataReaderFactory(
          context.getResourceLoader());
      String[] members = getMetadata(className).getMemberClassNames();
      this.memberConditions = getMemberConditions(members);
    }
View Full Code Here

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

   */
  public List<Class<?>> getAnnotatedMatches(Class<? extends Annotation> annotation,
    boolean includeSubclasses)
  {
    List<Class<?>> matches = new ArrayList<Class<?>>();
    MetadataReaderFactory f = new SimpleMetadataReaderFactory();
    for (Resource r : resources)
    {
      MetadataReader meta = null;
      try
      {
        meta = f.getMetadataReader(r);
      }
      catch (IOException e)
      {
        throw new RuntimeException("Unable to get MetadataReader for " + r, e);
      }
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.