Java Code Examples for org.springframework.core.type.AnnotationMetadata#hasMetaAnnotation()

The following examples show how to use org.springframework.core.type.AnnotationMetadata#hasMetaAnnotation() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DapengComponentScanRegistrar.java    From dapeng-soa with Apache License 2.0 5 votes vote down vote up
@Override
public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException {
    for(String name: registry.getBeanDefinitionNames()){
        BeanDefinition definition = registry.getBeanDefinition(name);
        if(definition instanceof AnnotatedBeanDefinition){
            AnnotationMetadata metadata = ((AnnotatedBeanDefinition) definition).getMetadata();
            if(metadata.hasAnnotation(DapengService.class.getName()) ||
                metadata.hasMetaAnnotation(DapengService.class.getName())){

                Map<String, Object> annotationAtts = metadata.getAnnotationAttributes(DapengService.class.getName());

                if (annotationAtts.containsKey("service")) {
                    char[] realServiceNameAsChars = ((Class)annotationAtts.get("service")).getSimpleName().toCharArray();
                    realServiceNameAsChars[0] += 32;
                    String realServiceName = String.valueOf(realServiceNameAsChars);
                    ConstructorArgumentValues paras = new ConstructorArgumentValues();
                    paras.addIndexedArgumentValue(0, new RuntimeBeanReference(realServiceName));
                    paras.addIndexedArgumentValue(1, realServiceName);

                    RootBeanDefinition serviceDef = new RootBeanDefinition(SoaProcessorFactory.class, paras, null);
                    serviceDef.setScope(BeanDefinition.SCOPE_SINGLETON);
                    serviceDef.setTargetType(SoaServiceDefinition.class);

                    registry.registerBeanDefinition(realServiceName + "-definition", serviceDef);
                }
            }
        }
    }
}
 
Example 2
Source File: AnnotationTypeFilter.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Override
protected boolean matchSelf(MetadataReader metadataReader) {
	AnnotationMetadata metadata = metadataReader.getAnnotationMetadata();
	return metadata.hasAnnotation(this.annotationType.getName()) ||
			(this.considerMetaAnnotations && metadata.hasMetaAnnotation(this.annotationType.getName()));
}
 
Example 3
Source File: AnnotationTypeFilter.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Override
protected boolean matchSelf(MetadataReader metadataReader) {
	AnnotationMetadata metadata = metadataReader.getAnnotationMetadata();
	return metadata.hasAnnotation(this.annotationType.getName()) ||
			(this.considerMetaAnnotations && metadata.hasMetaAnnotation(this.annotationType.getName()));
}
 
Example 4
Source File: AnnotationTypeFilter.java    From thinking-in-spring-boot-samples with Apache License 2.0 4 votes vote down vote up
@Override
protected boolean matchSelf(MetadataReader metadataReader) {
    AnnotationMetadata metadata = metadataReader.getAnnotationMetadata();
    return metadata.hasAnnotation(this.annotationType.getName()) ||
            (this.considerMetaAnnotations && metadata.hasMetaAnnotation(this.annotationType.getName()));
}
 
Example 5
Source File: AnnotationTypeFilter.java    From thinking-in-spring-boot-samples with Apache License 2.0 4 votes vote down vote up
@Override
protected boolean matchSelf(MetadataReader metadataReader) {
    AnnotationMetadata metadata = metadataReader.getAnnotationMetadata();
    return metadata.hasAnnotation(this.annotationType.getName()) ||
            (this.considerMetaAnnotations && metadata.hasMetaAnnotation(this.annotationType.getName()));
}
 
Example 6
Source File: AnnotationTypeFilter.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected boolean matchSelf(MetadataReader metadataReader) {
	AnnotationMetadata metadata = metadataReader.getAnnotationMetadata();
	return metadata.hasAnnotation(this.annotationType.getName()) ||
			(this.considerMetaAnnotations && metadata.hasMetaAnnotation(this.annotationType.getName()));
}
 
Example 7
Source File: AnnotationTypeFilter.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Override
protected boolean matchSelf(MetadataReader metadataReader) {
	AnnotationMetadata metadata = metadataReader.getAnnotationMetadata();
	return metadata.hasAnnotation(this.annotationType.getName()) ||
			(this.considerMetaAnnotations && metadata.hasMetaAnnotation(this.annotationType.getName()));
}