Skip to content

Commit 4a70506

Browse files
committed
DATACMNS-200 - Removed obsolete copy of AnnotationTypeFilter.
The copy of AnnotationTypeFilter is not necessary anymore as SPR-8336 was resolved with Spring 3.1.0.
1 parent c8f0f46 commit 4a70506

File tree

1 file changed

+1
-80
lines changed

1 file changed

+1
-80
lines changed

spring-data-commons-core/src/main/java/org/springframework/data/repository/config/RepositoryComponentProvider.java

Lines changed: 1 addition & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
package org.springframework.data.repository.config;
22

33
import java.io.IOException;
4-
import java.lang.annotation.Annotation;
5-
import java.lang.annotation.Inherited;
64
import java.util.ArrayList;
75
import java.util.List;
86

97
import org.springframework.beans.factory.annotation.AnnotatedBeanDefinition;
108
import org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider;
11-
import org.springframework.core.type.AnnotationMetadata;
129
import org.springframework.core.type.classreading.MetadataReader;
1310
import org.springframework.core.type.classreading.MetadataReaderFactory;
14-
import org.springframework.core.type.filter.AbstractTypeHierarchyTraversingFilter;
11+
import org.springframework.core.type.filter.AnnotationTypeFilter;
1512
import org.springframework.core.type.filter.AssignableTypeFilter;
1613
import org.springframework.core.type.filter.TypeFilter;
1714
import org.springframework.data.repository.NoRepositoryBean;
@@ -117,82 +114,6 @@ public boolean match(MetadataReader metadataReader, MetadataReaderFactory metada
117114
}
118115
}
119116

120-
// Copy of Spring's AnnotationTypeFilter until SPR-8336 gets resolved.
121-
122-
/**
123-
* A simple filter which matches classes with a given annotation, checking inherited annotations as well.
124-
* <p>
125-
* The matching logic mirrors that of <code>Class.isAnnotationPresent()</code>.
126-
*
127-
* @author Mark Fisher
128-
* @author Ramnivas Laddad
129-
* @author Juergen Hoeller
130-
* @since 2.5
131-
*/
132-
private static class AnnotationTypeFilter extends AbstractTypeHierarchyTraversingFilter {
133-
134-
private final Class<? extends Annotation> annotationType;
135-
136-
private final boolean considerMetaAnnotations;
137-
138-
/**
139-
* Create a new AnnotationTypeFilter for the given annotation type. This filter will also match meta-annotations. To
140-
* disable the meta-annotation matching, use the constructor that accepts a ' <code>considerMetaAnnotations</code>'
141-
* argument. The filter will not match interfaces.
142-
*
143-
* @param annotationType the annotation type to match
144-
*/
145-
public AnnotationTypeFilter(Class<? extends Annotation> annotationType) {
146-
this(annotationType, true);
147-
}
148-
149-
/**
150-
* Create a new AnnotationTypeFilter for the given annotation type. The filter will not match interfaces.
151-
*
152-
* @param annotationType the annotation type to match
153-
* @param considerMetaAnnotations whether to also match on meta-annotations
154-
*/
155-
public AnnotationTypeFilter(Class<? extends Annotation> annotationType, boolean considerMetaAnnotations) {
156-
this(annotationType, considerMetaAnnotations, false);
157-
}
158-
159-
/**
160-
* Create a new {@link AnnotationTypeFilter} for the given annotation type.
161-
*
162-
* @param annotationType the annotation type to match
163-
* @param considerMetaAnnotations whether to also match on meta-annotations
164-
* @param considerInterfaces whether to also match interfaces
165-
*/
166-
public AnnotationTypeFilter(Class<? extends Annotation> annotationType, boolean considerMetaAnnotations,
167-
boolean considerInterfaces) {
168-
super(annotationType.isAnnotationPresent(Inherited.class), considerInterfaces);
169-
this.annotationType = annotationType;
170-
this.considerMetaAnnotations = considerMetaAnnotations;
171-
}
172-
173-
@Override
174-
protected boolean matchSelf(MetadataReader metadataReader) {
175-
AnnotationMetadata metadata = metadataReader.getAnnotationMetadata();
176-
return metadata.hasAnnotation(this.annotationType.getName())
177-
|| (this.considerMetaAnnotations && metadata.hasMetaAnnotation(this.annotationType.getName()));
178-
}
179-
180-
@Override
181-
protected Boolean matchSuperClass(String superClassName) {
182-
if (Object.class.getName().equals(superClassName)) {
183-
return Boolean.FALSE;
184-
} else if (superClassName.startsWith("java.")) {
185-
try {
186-
Class<?> clazz = getClass().getClassLoader().loadClass(superClassName);
187-
return (clazz.getAnnotation(this.annotationType) != null);
188-
} catch (ClassNotFoundException ex) {
189-
// Class not found - can't determine a match that way.
190-
}
191-
}
192-
return null;
193-
}
194-
}
195-
196117
/**
197118
* Helper class to create a {@link TypeFilter} that matches if all the delegates match.
198119
*

0 commit comments

Comments
 (0)