diff --git a/spring-core/src/main/java/org/springframework/core/annotation/AnnotationAttributeExtractor.java b/spring-core/src/main/java/org/springframework/core/annotation/AnnotationAttributeExtractor.java deleted file mode 100644 index a6844ecec30..00000000000 --- a/spring-core/src/main/java/org/springframework/core/annotation/AnnotationAttributeExtractor.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2002-2017 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.core.annotation; - -import java.lang.annotation.Annotation; -import java.lang.reflect.Method; - -import org.springframework.lang.Nullable; - -/** - * An {@code AnnotationAttributeExtractor} is responsible for - * {@linkplain #getAttributeValue extracting} annotation attribute values - * from an underlying {@linkplain #getSource source} such as an - * {@code Annotation} or a {@code Map}. - * - * @author Sam Brannen - * @since 4.2 - * @param the type of source supported by this extractor - * @see SynthesizedAnnotationInvocationHandler - */ -interface AnnotationAttributeExtractor { - - /** - * Get the type of annotation that this extractor extracts attribute - * values for. - */ - Class getAnnotationType(); - - /** - * Get the element that is annotated with an annotation of the annotation - * type supported by this extractor. - * @return the annotated element, or {@code null} if unknown - */ - @Nullable - Object getAnnotatedElement(); - - /** - * Get the underlying source of annotation attributes. - */ - S getSource(); - - /** - * Get the attribute value from the underlying {@linkplain #getSource source} - * that corresponds to the supplied attribute method. - * @param attributeMethod an attribute method from the annotation type - * supported by this extractor - * @return the value of the annotation attribute - */ - @Nullable - Object getAttributeValue(Method attributeMethod); - -} diff --git a/spring-core/src/main/java/org/springframework/core/annotation/SynthesizedMergedAnnotationInvocationHandler.java b/spring-core/src/main/java/org/springframework/core/annotation/SynthesizedMergedAnnotationInvocationHandler.java index 6bd6caaa345..89eab8386f9 100644 --- a/spring-core/src/main/java/org/springframework/core/annotation/SynthesizedMergedAnnotationInvocationHandler.java +++ b/spring-core/src/main/java/org/springframework/core/annotation/SynthesizedMergedAnnotationInvocationHandler.java @@ -41,7 +41,6 @@ import org.springframework.util.ReflectionUtils; * @since 5.2 * @param the annotation type * @see Annotation - * @see AnnotationAttributeExtractor * @see AnnotationUtils#synthesizeAnnotation(Annotation, AnnotatedElement) */ final class SynthesizedMergedAnnotationInvocationHandler implements InvocationHandler { diff --git a/spring-core/src/test/java/org/springframework/core/annotation/AbstractAliasAwareAnnotationAttributeExtractorTestCase.java b/spring-core/src/test/java/org/springframework/core/annotation/AbstractAliasAwareAnnotationAttributeExtractorTestCase.java deleted file mode 100644 index 5d9bf260160..00000000000 --- a/spring-core/src/test/java/org/springframework/core/annotation/AbstractAliasAwareAnnotationAttributeExtractorTestCase.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2002-2015 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.core.annotation; - -import java.lang.annotation.Annotation; -import java.lang.reflect.Method; - -import org.junit.Test; - -import org.springframework.core.annotation.AnnotationUtilsTests.GroovyImplicitAliasesContextConfigClass; -import org.springframework.core.annotation.AnnotationUtilsTests.ImplicitAliasesContextConfig; -import org.springframework.core.annotation.AnnotationUtilsTests.Location1ImplicitAliasesContextConfigClass; -import org.springframework.core.annotation.AnnotationUtilsTests.Location2ImplicitAliasesContextConfigClass; -import org.springframework.core.annotation.AnnotationUtilsTests.Location3ImplicitAliasesContextConfigClass; -import org.springframework.core.annotation.AnnotationUtilsTests.ValueImplicitAliasesContextConfigClass; -import org.springframework.core.annotation.AnnotationUtilsTests.XmlImplicitAliasesContextConfigClass; - -import static org.hamcrest.CoreMatchers.*; -import static org.junit.Assert.*; - -/** - * Abstract base class for tests involving concrete implementations of - * {@link AbstractAliasAwareAnnotationAttributeExtractor}. - * - * @author Sam Brannen - * @since 4.2.1 - */ -public abstract class AbstractAliasAwareAnnotationAttributeExtractorTestCase { - - @Test - public void getAttributeValueForImplicitAliases() throws Exception { - assertGetAttributeValueForImplicitAliases(GroovyImplicitAliasesContextConfigClass.class, "groovyScript"); - assertGetAttributeValueForImplicitAliases(XmlImplicitAliasesContextConfigClass.class, "xmlFile"); - assertGetAttributeValueForImplicitAliases(ValueImplicitAliasesContextConfigClass.class, "value"); - assertGetAttributeValueForImplicitAliases(Location1ImplicitAliasesContextConfigClass.class, "location1"); - assertGetAttributeValueForImplicitAliases(Location2ImplicitAliasesContextConfigClass.class, "location2"); - assertGetAttributeValueForImplicitAliases(Location3ImplicitAliasesContextConfigClass.class, "location3"); - } - - private void assertGetAttributeValueForImplicitAliases(Class clazz, String expected) throws Exception { - Method xmlFile = ImplicitAliasesContextConfig.class.getDeclaredMethod("xmlFile"); - Method groovyScript = ImplicitAliasesContextConfig.class.getDeclaredMethod("groovyScript"); - Method value = ImplicitAliasesContextConfig.class.getDeclaredMethod("value"); - - AnnotationAttributeExtractor extractor = createExtractorFor(clazz, expected, ImplicitAliasesContextConfig.class); - - assertThat(extractor.getAttributeValue(value), is(expected)); - assertThat(extractor.getAttributeValue(groovyScript), is(expected)); - assertThat(extractor.getAttributeValue(xmlFile), is(expected)); - } - - protected abstract AnnotationAttributeExtractor createExtractorFor(Class clazz, String expected, Class annotationType); - -}