Refine unmapped property support

Replace `@UnmappedPropertyValue` with a `skip` attribute on
`@PropertyMapping` so that any default attribute value can be skipped.

Closes gh-6455
This commit is contained in:
Phillip Webb
2016-07-27 13:07:39 -07:00
parent ac1ad2a145
commit 5d9836b3b1
6 changed files with 51 additions and 45 deletions

View File

@@ -262,7 +262,7 @@ public class AnnotationsPropertySourceTests {
}
@Retention(RetentionPolicy.RUNTIME)
@PropertyMapping(map = false)
@PropertyMapping(skip = SkipPropertyMapping.YES)
static @interface NotMappedAtTypeLevelAnnotation {
@PropertyMapping
@@ -283,7 +283,7 @@ public class AnnotationsPropertySourceTests {
String value();
@PropertyMapping(map = false)
@PropertyMapping(skip = SkipPropertyMapping.YES)
String ignore() default "xyz";
}
@@ -362,7 +362,9 @@ public class AnnotationsPropertySourceTests {
static @interface AttributeWithAliasAnnotation {
@AliasFor(annotation = AliasedAttributeAnnotation.class, attribute = "value")
String value() default "foo";
String value()
default "foo";
String someOtherAttribute() default "shouldNotBeMapped";
@@ -410,13 +412,14 @@ public class AnnotationsPropertySourceTests {
@PropertyMapping("testenum")
static @interface EnumAnnotation {
EnumItem value();
@PropertyMapping(skip = SkipPropertyMapping.ON_DEFAULT_VALUE)
EnumItem value() default EnumItem.DEFAULT;
}
enum EnumItem {
@UnmappedPropertyValue DEFAULT,
DEFAULT,
ONE,