Skip to content
This repository has been archived by the owner on Jan 22, 2019. It is now read-only.

Commit

Permalink
Fix #47; consider @XmlAttribute.required
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Sep 9, 2015
1 parent 4175f2f commit 50219b5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
5 changes: 5 additions & 0 deletions release-notes/VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ Project: jackson-module-jaxb-annotations
=== Releases ===
------------------------------------------------------------------------

2.6.2 (not yet released)

#47: JaxbAnnotationIntrospector does not pick up 'required' property of @XmlAttribute
(reported by phantomjinx@github)

2.6.1 (09-Aug-2015)
2.6.0 (19-Jul-2015)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1042,8 +1042,21 @@ public boolean hasCreatorAnnotation(Annotated am) {

@Override
public Boolean hasRequiredMarker(AnnotatedMember m) {
XmlElement annotation = m.getAnnotation(XmlElement.class);
return annotation == null ? null : Boolean.valueOf(annotation.required());
XmlElement elem = m.getAnnotation(XmlElement.class);
if ((elem != null) && elem.required()) {
return Boolean.TRUE;
}
XmlAttribute attr = m.getAnnotation(XmlAttribute.class);
if ((attr != null) && attr.required()) {
return Boolean.TRUE;
}
// 09-Sep-2015, tatu: Not 100% sure that we should ever return `false`
// here (as it blocks calls to secondary introspector), but since that
// was the existing behavior before 2.6, is retained for now.
if ((elem != null) || (attr != null)) {
return null;
}
return Boolean.FALSE;
}

@Override
Expand Down

0 comments on commit 50219b5

Please sign in to comment.