Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 368547 - Enhancement: Provide a means to default the nillable setting for all @XmlElement
Summary: Enhancement: Provide a means to default the nillable setting for all @XmlEl...
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 enhancement with 3 votes (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL: http://stackoverflow.com/questions/88...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-13 09:28 EST by Blaise Doughan CLA
Modified: 2022-06-09 10:27 EDT (History)
3 users (show)

See Also:


Attachments
Patch fix for this bug. (266.21 KB, patch)
2014-07-24 08:11 EDT, Martin Vojtek CLA
no flags Details | Diff
same patch rebased against master with CRLF fix (539.98 KB, patch)
2014-07-24 08:12 EDT, Martin Vojtek CLA
tomas.kraus: review+
Details | Diff
javadocs (23.84 KB, patch)
2014-07-24 15:28 EDT, Martin Vojtek CLA
tomas.kraus: review+
Details | Diff
rebased against new master (544.27 KB, patch)
2014-07-25 07:43 EDT, Martin Vojtek CLA
no flags Details | Diff
fixed CRLF (276.27 KB, patch)
2014-07-25 08:43 EDT, Martin Vojtek CLA
voytoo: review?
tomas.kraus: review+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Blaise Doughan CLA 2012-01-13 09:28:23 EST
The default value for nillable on the @XmlElement annotation is false.  If you wanted to make all the fields/properties mapped to XML elements nillable you would need to annotate every one.  To make this easier we could provide an extension to set a package level default.
Comment 1 Martin Vojtek CLA 2014-07-03 05:30:52 EDT
I am working on the enhancement.
Comment 2 Martin Vojtek CLA 2014-07-24 08:11:00 EDT
Created attachment 245337 [details]
Patch fix for this bug.

Introduced new annotation XmlElementNillable with ElementType.TYPE and ElementType.PACKAGE targets. Annotation with ElementType.TYPE overrides annotation with ElementType.PACKAGE.

I have also extended annotation XmlNullPolicy to target ElementType.TYPE and ElementType.PACKAGE. I think it makes sense and its purpose and behavior is different than XmlElementNillable annotation. Purpose of XmlElementNillable is to extend standard XmlElement annotation with targets ElementType.TYPE and ElementType.PACKAGE.

New xsd schema eclipselink_oxm_2.6.xsd introduced, which contains new xml elements xml-element-nillable and xml-null-policy.
Comment 3 Martin Vojtek CLA 2014-07-24 08:12:09 EDT
Created attachment 245338 [details]
same patch rebased against master with CRLF fix

This is the same patch as before, but it is created against current master. It also fixes CRLF issues. But is much bigger.
Comment 4 Tomas Kraus CLA 2014-07-24 10:33:41 EDT
testBeanValidation	Error	Unable to create a Configuration, because no Bean Validation provider could be found. Add a provider like Hibernate Validator (RI) to your classpath.

javax.validation.ValidationException: Unable to create a Configuration, because no Bean Validation provider could be found. Add a provider like Hibernate Validator (RI) to your classpath.
at javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:271)
at javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:110)
at org.eclipse.persistence.testing.jaxb.beanvalidation.BeanValidationRuntimeTestCase.setUp(BeanValidationRuntimeTestCase.java:215)

Nevim jestli je to nejaky starsi problem, ale tehle test mi neprosel.
Comment 5 Tomas Kraus CLA 2014-07-24 10:34:55 EDT
Oops,

'Nevim jestli je to nejaky starsi problem, ale tehle test mi neprosel.' ->
'I'm not sure if this is some older issue but this test did not passed.'
Comment 6 Martin Vojtek CLA 2014-07-24 15:28:43 EDT
Created attachment 245348 [details]
javadocs

Added javadocs for XmlElementNillable annotation and for corresponding tests.
Comment 7 Martin Vojtek CLA 2014-07-25 07:43:58 EDT
Created attachment 245382 [details]
rebased against new master

rebased against new master
Comment 8 Martin Vojtek CLA 2014-07-25 08:43:44 EDT
Created attachment 245384 [details]
fixed CRLF

fixed CRLF
Comment 10 Eclipse Webmaster CLA 2022-06-09 10:15:02 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink
Comment 11 Eclipse Webmaster CLA 2022-06-09 10:27:53 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink