当前位置: 首页>>代码示例>>Java>>正文


Java MetadataReader.getAnnotationMetadata方法代码示例

本文整理汇总了Java中org.springframework.core.type.classreading.MetadataReader.getAnnotationMetadata方法的典型用法代码示例。如果您正苦于以下问题:Java MetadataReader.getAnnotationMetadata方法的具体用法?Java MetadataReader.getAnnotationMetadata怎么用?Java MetadataReader.getAnnotationMetadata使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.core.type.classreading.MetadataReader的用法示例。


在下文中一共展示了MetadataReader.getAnnotationMetadata方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findMangoDaoClasses

import org.springframework.core.type.classreading.MetadataReader; //导入方法依赖的package包/类
private List<Class<?>> findMangoDaoClasses(String packages) {
    try {
        List<Class<?>> daos = new ArrayList<Class<?>>();
        ResourcePatternResolver resourcePatternResolver = new PathMatchingResourcePatternResolver();
        MetadataReaderFactory metadataReaderFactory = new CachingMetadataReaderFactory(resourcePatternResolver);
        for (String locationPattern : getLocationPattern(packages)) {
            Resource[] rs = resourcePatternResolver.getResources(locationPattern);
            for (Resource r : rs) {
                MetadataReader reader = metadataReaderFactory.getMetadataReader(r);
                AnnotationMetadata annotationMD = reader.getAnnotationMetadata();
                if (annotationMD.hasAnnotation(DB.class.getName())) {
                    ClassMetadata clazzMD = reader.getClassMetadata();
                    daos.add(Class.forName(clazzMD.getClassName()));
                }
            }
        }
        return daos;
    } catch (Exception e) {
        throw new IllegalStateException(e.getMessage(), e);
    }
}
 
开发者ID:jfaster,项目名称:mango-spring-boot-starter,代码行数:22,代码来源:MangoDaoAutoCreator.java

示例2: findConfigurationClasses

import org.springframework.core.type.classreading.MetadataReader; //导入方法依赖的package包/类
private Set<AnnotationMetadata> findConfigurationClasses() throws IOException {
	Set<AnnotationMetadata> configurationClasses = new HashSet<AnnotationMetadata>();
	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())) {
				configurationClasses.add(annotationMetadata);
			}
		}
	}
	return configurationClasses;
}
 
开发者ID:philwebb,项目名称:spring-boot-concourse,代码行数:19,代码来源:AbstractConfigurationClassTests.java

示例3: customRequestScopeViaAsm

import org.springframework.core.type.classreading.MetadataReader; //导入方法依赖的package包/类
@Test
public void customRequestScopeViaAsm() throws IOException {
	MetadataReaderFactory readerFactory = new SimpleMetadataReaderFactory();
	MetadataReader reader = readerFactory.getMetadataReader(AnnotatedWithCustomRequestScope.class.getName());
	AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(reader.getAnnotationMetadata());
	ScopeMetadata scopeMetadata = this.scopeMetadataResolver.resolveScopeMetadata(bd);
	assertNotNull("resolveScopeMetadata(..) must *never* return null.", scopeMetadata);
	assertEquals("request", scopeMetadata.getScopeName());
	assertEquals(NO, scopeMetadata.getScopedProxyMode());
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:11,代码来源:AnnotationScopeMetadataResolverTests.java

示例4: customRequestScopeWithAttributeViaAsm

import org.springframework.core.type.classreading.MetadataReader; //导入方法依赖的package包/类
@Test
public void customRequestScopeWithAttributeViaAsm() throws IOException {
	MetadataReaderFactory readerFactory = new SimpleMetadataReaderFactory();
	MetadataReader reader = readerFactory.getMetadataReader(AnnotatedWithCustomRequestScopeWithAttributeOverride.class.getName());
	AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(reader.getAnnotationMetadata());
	ScopeMetadata scopeMetadata = this.scopeMetadataResolver.resolveScopeMetadata(bd);
	assertNotNull("resolveScopeMetadata(..) must *never* return null.", scopeMetadata);
	assertEquals("request", scopeMetadata.getScopeName());
	assertEquals(TARGET_CLASS, scopeMetadata.getScopedProxyMode());
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:11,代码来源:AnnotationScopeMetadataResolverTests.java

示例5: asmAnnotationMetadata

import org.springframework.core.type.classreading.MetadataReader; //导入方法依赖的package包/类
@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);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:9,代码来源:AnnotationMetadataTests.java

示例6: asmAnnotationMetadataForSubclass

import org.springframework.core.type.classreading.MetadataReader; //导入方法依赖的package包/类
@Test
public void asmAnnotationMetadataForSubclass() throws Exception {
	MetadataReaderFactory metadataReaderFactory = new SimpleMetadataReaderFactory();
	MetadataReader metadataReader = metadataReaderFactory.getMetadataReader(AnnotatedComponentSubClass.class.getName());
	AnnotationMetadata metadata = metadataReader.getAnnotationMetadata();
	doTestSubClassAnnotationInfo(metadata);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:8,代码来源:AnnotationMetadataTests.java

示例7: asmAnnotationMetadataForInterface

import org.springframework.core.type.classreading.MetadataReader; //导入方法依赖的package包/类
@Test
public void asmAnnotationMetadataForInterface() throws Exception {
	MetadataReaderFactory metadataReaderFactory = new SimpleMetadataReaderFactory();
	MetadataReader metadataReader = metadataReaderFactory.getMetadataReader(AnnotationMetadata.class.getName());
	AnnotationMetadata metadata = metadataReader.getAnnotationMetadata();
	doTestMetadataForInterfaceClass(metadata);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:8,代码来源:AnnotationMetadataTests.java

示例8: asmAnnotationMetadataForAnnotation

import org.springframework.core.type.classreading.MetadataReader; //导入方法依赖的package包/类
@Test
public void asmAnnotationMetadataForAnnotation() throws Exception {
	MetadataReaderFactory metadataReaderFactory = new SimpleMetadataReaderFactory();
	MetadataReader metadataReader = metadataReaderFactory.getMetadataReader(Component.class.getName());
	AnnotationMetadata metadata = metadataReader.getAnnotationMetadata();
	doTestMetadataForAnnotationClass(metadata);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:8,代码来源:AnnotationMetadataTests.java

示例9: metaAnnotationOverridesUsingAnnotationMetadataReadingVisitor

import org.springframework.core.type.classreading.MetadataReader; //导入方法依赖的package包/类
@Test
public void metaAnnotationOverridesUsingAnnotationMetadataReadingVisitor() throws Exception {
	MetadataReaderFactory metadataReaderFactory = new SimpleMetadataReaderFactory();
	MetadataReader metadataReader = metadataReaderFactory.getMetadataReader(ComposedConfigurationWithAttributeOverridesClass.class.getName());
	AnnotationMetadata metadata = metadataReader.getAnnotationMetadata();
	assertMetaAnnotationOverrides(metadata);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:8,代码来源:AnnotationMetadataTests.java

示例10: multipleAnnotationsWithIdenticalAttributeNamesUsingAnnotationMetadataReadingVisitor

import org.springframework.core.type.classreading.MetadataReader; //导入方法依赖的package包/类
/**
 * 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);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:11,代码来源:AnnotationMetadataTests.java

示例11: composedAnnotationWithMetaAnnotationsWithIdenticalAttributeNamesUsingAnnotationMetadataReadingVisitor

import org.springframework.core.type.classreading.MetadataReader; //导入方法依赖的package包/类
/**
 * 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);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:11,代码来源:AnnotationMetadataTests.java

示例12: ConfigurationClass

import org.springframework.core.type.classreading.MetadataReader; //导入方法依赖的package包/类
/**
 * Create a new {@link ConfigurationClass} with the given name.
 * @param metadataReader reader used to parse the underlying {@link Class}
 * @param beanName must not be {@code null}
 * @throws IllegalArgumentException if beanName is null (as of Spring 3.1.1)
 * @see ConfigurationClass#ConfigurationClass(Class, ConfigurationClass)
 */
public ConfigurationClass(MetadataReader metadataReader, String beanName) {
	Assert.hasText(beanName, "bean name must not be null");
	this.metadata = metadataReader.getAnnotationMetadata();
	this.resource = metadataReader.getResource();
	this.beanName = beanName;
	this.importedBy = null;
}
 
开发者ID:panguixiang,项目名称:my-spring-cache-redis,代码行数:15,代码来源:ConfigurationClass.java

示例13: ConfigurationClass

import org.springframework.core.type.classreading.MetadataReader; //导入方法依赖的package包/类
/**
 * Create a new {@link ConfigurationClass} with the given name.
 * @param metadataReader reader used to parse the underlying {@link Class}
 * @param beanName must not be {@code null}
 * @see ConfigurationClass#ConfigurationClass(Class, ConfigurationClass)
 */
public ConfigurationClass(MetadataReader metadataReader, String beanName) {
	Assert.hasText(beanName, "Bean name must not be null");
	this.metadata = metadataReader.getAnnotationMetadata();
	this.resource = metadataReader.getResource();
	this.beanName = beanName;
}
 
开发者ID:txazo,项目名称:spring,代码行数:13,代码来源:ConfigurationClass.java

示例14: ScannedGenericBeanDefinition

import org.springframework.core.type.classreading.MetadataReader; //导入方法依赖的package包/类
/**
 * Create a new ScannedGenericBeanDefinition for the class that the
 * given MetadataReader describes.
 * @param metadataReader the MetadataReader for the scanned target class
 */
public ScannedGenericBeanDefinition(MetadataReader metadataReader) {
	Assert.notNull(metadataReader, "MetadataReader must not be null");
	this.metadata = metadataReader.getAnnotationMetadata();
	setBeanClassName(this.metadata.getClassName());
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:11,代码来源:ScannedGenericBeanDefinition.java

示例15: getAnnotationMetadata

import org.springframework.core.type.classreading.MetadataReader; //导入方法依赖的package包/类
protected AnnotationMetadata getAnnotationMetadata(String classname) throws IOException
{
    MetadataReader metadataReader = this.metadataReaderFactory.getMetadataReader(classname);
    AnnotationMetadata annotationMetaData = metadataReader.getAnnotationMetadata();
    return annotationMetaData;
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:7,代码来源:PublicApiHttpClient.java


注:本文中的org.springframework.core.type.classreading.MetadataReader.getAnnotationMetadata方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。