| Summary: | @XmlNullPolicy, Collections, and Empty Nodes | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | z_Archived | Reporter: | Blaise Doughan <blaise.doughan> | ||||||||||
| Component: | Eclipselink | Assignee: | Nobody - feel free to take it <nobody> | ||||||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||||||
| Severity: | normal | ||||||||||||
| Priority: | P3 | CC: | eclipselink.oxm-inbox | ||||||||||
| Version: | unspecified | ||||||||||||
| Target Milestone: | --- | ||||||||||||
| Hardware: | PC | ||||||||||||
| OS: | Windows XP | ||||||||||||
| Whiteboard: | |||||||||||||
| Bug Depends on: | |||||||||||||
| Bug Blocks: | 331151 | ||||||||||||
| Attachments: |
|
||||||||||||
Created attachment 183266 [details]
Core - Fix
Created attachment 183268 [details]
MOXy - Test Cases
Created attachment 183879 [details]
MOXy - Test Cases
Created attachment 183880 [details]
Core - Fix
Fix checked into trunk at rev: 8569 Code reviewed by: Matt MacIvor - Added CompositeCollectionMappingContentHandler - Refactored CompositeObjectMappingContentHandler to have a super type that CompositeCollectionMappingContentHandler could leverage to share behaviour. - Added similar support to CompositeCollectionMapping from CompositeObjectMapping to handle empty element null values. The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink |
For the following class: import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import org.eclipse.persistence.oxm.annotations.XmlMarshalNullRepresentation; import org.eclipse.persistence.oxm.annotations.XmlNullPolicy; @XmlRootElement public class Course { @XmlElement (name = "book") @XmlNullPolicy(nullRepresentationForXml = XmlMarshalNullRepresentation.EMPTY_NODE, emptyNodeRepresentsNull=true) List<Book> requiredBooks = new ArrayList<Book>(); } The XML document: <?xml version="1.0" encoding="UTF-8"?> <course> <book/> <book> <title>Hello World</title> </book> <book/> </course> Should unmarshal to an object where the requiredBooks property contains two nulls and an instance of Book. Currently this is not working.