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

The following examples show how to use org.springframework.core.type.AnnotationMetadata#isConcrete() . 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: PublicApiHttpClient.java    From alfresco-remote-api with GNU Lesser General Public License v3.0 6 votes vote down vote up
private Pair<String, String> getRelationCollectionInfo(Class<?> resourceClass) throws IOException
{
    AnnotationMetadata annotationMetaData = getAnnotationMetadata(resourceClass.getCanonicalName());
    if (annotationMetaData.isConcrete() && annotationMetaData.isIndependent())
    {
        if (annotationMetaData.getAnnotationTypes().contains(RelationshipResource.class.getCanonicalName()))
        {
            Map<String, Object> attrs = annotationMetaData.getAnnotationAttributes(RelationshipResource.class.getName());
            String relationshipCollectionName = (String) attrs.get("name");
            Class<?> entityResource = (Class<?>) attrs.get("entityResource");

            String entityCollectionName = getEntityCollectionInfo(entityResource.getCanonicalName());

            Pair<String, String> ret = new Pair<String, String>(entityCollectionName, relationshipCollectionName);
            return ret;
        }
        else
        {
            return null;
        }
    }
    else
    {
        throw new AlfrescoRuntimeException("");
    }
}
 
Example 2
Source File: PublicApiHttpClient.java    From alfresco-remote-api with GNU Lesser General Public License v3.0 6 votes vote down vote up
private String getEntityCollectionInfo(String className) throws IOException
{
    AnnotationMetadata annotationMetaData = getAnnotationMetadata(className);
    if (annotationMetaData.isConcrete() && annotationMetaData.isIndependent())
    {
        if (annotationMetaData.getAnnotationTypes().contains(EntityResource.class.getCanonicalName()))
        {
            Map<String, Object> attrs = annotationMetaData.getAnnotationAttributes(EntityResource.class.getName());
            return (String) attrs.get("name");
        }
        else
        {
            return null;
        }
    }
    else
    {
        throw new AlfrescoRuntimeException("");
    }
}
 
Example 3
Source File: ConfigurationClassPathBeanDefinitionScanner.java    From conf4j with MIT License 4 votes vote down vote up
@Override
protected boolean isCandidateComponent(AnnotatedBeanDefinition beanDefinition) {
    AnnotationMetadata metadata = beanDefinition.getMetadata();
    return !metadata.isConcrete() && !metadata.isAnnotation() && metadata.isIndependent();
}
 
Example 4
Source File: ClassPathScanningCandidateComponentProvider.java    From spring-analysis-note with MIT License 2 votes vote down vote up
/**
 * Determine whether the given bean definition qualifies as candidate.
 * <p>The default implementation checks whether the class is not an interface
 * and not dependent on an enclosing class.
 * <p>Can be overridden in subclasses.
 * @param beanDefinition the bean definition to check
 * @return whether the bean definition qualifies as a candidate component
 */
protected boolean isCandidateComponent(AnnotatedBeanDefinition beanDefinition) {
	AnnotationMetadata metadata = beanDefinition.getMetadata();
	return (metadata.isIndependent() && (metadata.isConcrete() ||
			(metadata.isAbstract() && metadata.hasAnnotatedMethods(Lookup.class.getName()))));
}
 
Example 5
Source File: ClassPathScanningCandidateComponentProvider.java    From java-technology-stack with MIT License 2 votes vote down vote up
/**
 * Determine whether the given bean definition qualifies as candidate.
 * <p>The default implementation checks whether the class is not an interface
 * and not dependent on an enclosing class.
 * <p>Can be overridden in subclasses.
 * @param beanDefinition the bean definition to check
 * @return whether the bean definition qualifies as a candidate component
 */
protected boolean isCandidateComponent(AnnotatedBeanDefinition beanDefinition) {
	AnnotationMetadata metadata = beanDefinition.getMetadata();
	return (metadata.isIndependent() && (metadata.isConcrete() ||
			(metadata.isAbstract() && metadata.hasAnnotatedMethods(Lookup.class.getName()))));
}
 
Example 6
Source File: ClassPathScanningCandidateComponentProvider.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Determine whether the given bean definition qualifies as candidate.
 * <p>The default implementation checks whether the class is not an interface
 * and not dependent on an enclosing class.
 * <p>Can be overridden in subclasses.
 * @param beanDefinition the bean definition to check
 * @return whether the bean definition qualifies as a candidate component
 */
protected boolean isCandidateComponent(AnnotatedBeanDefinition beanDefinition) {
	AnnotationMetadata metadata = beanDefinition.getMetadata();
	return (metadata.isIndependent() && (metadata.isConcrete() ||
			(metadata.isAbstract() && metadata.hasAnnotatedMethods(Lookup.class.getName()))));
}