提取获取注解属性值相关逻辑至注解属性值提取器

This commit is contained in:
huangchengxing
2022-07-16 16:19:54 +08:00
parent 931965301b
commit d873b6e9da
15 changed files with 128 additions and 63 deletions

View File

@@ -108,7 +108,7 @@ public class AliasAnnotationPostProcessorTest {
}
@Override
public Object getAttribute(String attributeName, Class<?> attributeType) {
public Object getAttributeValue(String attributeName, Class<?> attributeType) {
return null;
}
@@ -185,6 +185,11 @@ public class AliasAnnotationPostProcessorTest {
public Class<? extends Annotation> annotationType() {
return annotation.annotationType();
}
@Override
public Object getAttributeValue(String attributeName, Class<?> attributeType) {
return null;
}
}
}

View File

@@ -136,7 +136,7 @@ public class AliasLinkAnnotationPostProcessorTest {
}
@Override
public Object getAttribute(String attributeName, Class<?> attributeType) {
public Object getAttributeValue(String attributeName, Class<?> attributeType) {
return null;
}
@@ -213,6 +213,11 @@ public class AliasLinkAnnotationPostProcessorTest {
public Class<? extends Annotation> annotationType() {
return annotation.annotationType();
}
@Override
public Object getAttributeValue(String attributeName, Class<?> attributeType) {
return null;
}
}
}

View File

@@ -42,6 +42,7 @@ public class AnnotationUtilTest {
// 加别名适配
final AnnotationForTest annotation = AnnotationUtil.getAnnotationAlias(ClassWithAnnotation.class, AnnotationForTest.class);
Assert.assertEquals("测试", annotation.retry());
Assert.assertTrue(AnnotationUtil.isSynthesizedAnnotation(annotation));
}
@AnnotationForTest("测试")

View File

@@ -90,6 +90,10 @@ public class CacheableSynthesizedAnnotationAttributeProcessorTest {
return null;
}
@Override
public Object getAttributeValue(String attributeName, Class<?> attributeType) {
return null;
}
}
}

View File

@@ -110,7 +110,7 @@ public class MirrorLinkAnnotationPostProcessorTest {
}
@Override
public Object getAttribute(String attributeName, Class<?> attributeType) {
public Object getAttributeValue(String attributeName, Class<?> attributeType) {
return null;
}
@@ -188,6 +188,11 @@ public class MirrorLinkAnnotationPostProcessorTest {
public Class<? extends Annotation> annotationType() {
return annotation.annotationType();
}
@Override
public Object getAttributeValue(String attributeName, Class<?> attributeType) {
return null;
}
}
}

View File

@@ -136,6 +136,11 @@ public class SynthesizedAnnotationSelectorTest {
public Class<? extends Annotation> annotationType() {
return null;
}
@Override
public Object getAttributeValue(String attributeName, Class<?> attributeType) {
return null;
}
}
}

View File

@@ -60,10 +60,10 @@ public class SyntheticMetaAnnotationTest {
Assert.assertEquals(syntheticMetaAnnotation.annotationType(), SynthesizedMetaAggregateAnnotation.class);
Assert.assertEquals(3, syntheticMetaAnnotation.getAnnotations().length);
Assert.assertEquals("Child!", syntheticMetaAnnotation.getAttribute("childValue", String.class));
Assert.assertEquals("Child!", syntheticMetaAnnotation.getAttribute("childValueAlias", String.class));
Assert.assertEquals("Child's Parent!", syntheticMetaAnnotation.getAttribute("parentValue", String.class));
Assert.assertEquals("Child's GrandParent!", syntheticMetaAnnotation.getAttribute("grandParentValue", String.class));
Assert.assertEquals("Child!", syntheticMetaAnnotation.getAttributeValue("childValue", String.class));
Assert.assertEquals("Child!", syntheticMetaAnnotation.getAttributeValue("childValueAlias", String.class));
Assert.assertEquals("Child's Parent!", syntheticMetaAnnotation.getAttributeValue("parentValue", String.class));
Assert.assertEquals("Child's GrandParent!", syntheticMetaAnnotation.getAttributeValue("grandParentValue", String.class));
}
@Test