-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix regression for JAXB annotations by implementing findEnumValues(MapperConfig, AnnotatedClass, Enum[], String[])
#212
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -969,6 +969,36 @@ public String[] findEnumValues(Class<?> enumType, Enum<?>[] enumValues, String[] | |
return names; | ||
} | ||
|
||
/** | ||
* @see JacksonAnnotationIntrospector#findEnumValues(MapperConfig, AnnotatedClass, Enum[], String[]) | ||
* @since 2.16 | ||
*/ | ||
@Override | ||
public String[] findEnumValues(MapperConfig<?> config, AnnotatedClass annotatedClass, | ||
Enum<?>[] enumValues, String[] names) | ||
{ | ||
Map<String, String> enumToPropertyMap = new LinkedHashMap<String, String>(); | ||
for (AnnotatedField field : annotatedClass.fields()) { | ||
XmlEnumValue property = field.getAnnotation(XmlEnumValue.class); | ||
if (property != null) { | ||
String propValue = property.value(); | ||
if (propValue != null && !propValue.isEmpty()) { | ||
enumToPropertyMap.put(field.getName(), propValue); | ||
} | ||
} | ||
} | ||
|
||
// and then stitch them together if and as necessary | ||
for (int i = 0, end = enumValues.length; i < end; ++i) { | ||
String defName = enumValues[i].name(); | ||
String explValue = enumToPropertyMap.get(defName); | ||
if (explValue != null) { | ||
names[i] = explValue; | ||
} | ||
} | ||
return names; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @cowtowncoder Changes in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correct, thanks. I think build fails on first module failing to pass tests so since "jakarta-xmlbind" is run before "jaxb" it'll be one breaking build. |
||
|
||
/* | ||
/********************************************************** | ||
/* Deserialization: general annotations | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All same wrt to original method, except line 964 w/
@XmlEnumValue