Skip to content
This repository has been archived by the owner on Sep 21, 2022. It is now read-only.

Improve value-constructor plugin to use only elements with minOccurs greater than 0 with no default value and only required attributes #11

Open
glassfishrobot opened this issue Oct 11, 2008 · 7 comments

Comments

@glassfishrobot
Copy link
Contributor

Currently, the value constructor plugin generates a fully initializing
constructor with all elements and attributes.

Client codes that use these constructors will break when a new optional element
or attribute is added to the schema.

A better solution is to generate a partially initializing constructors with only
elements that have minOccurs greater than 0 and with no default value and
required attributes.

It'd be better to use the default-value-plugin to provide default values.

Alex Wei

Environment

Operating System: All
Platform: All

Affected Versions

[current]

@glassfishrobot
Copy link
Contributor Author

Reported by ozgwei

@glassfishrobot
Copy link
Contributor Author

Issue-Links:
blocks
JAXB2_COMMONS-14

@glassfishrobot
Copy link
Contributor Author

Was assigned to lexi

@glassfishrobot
Copy link
Contributor Author

File: value-constructor-patch.txt
Attached By: ozgwei

@glassfishrobot
Copy link
Contributor Author

ozgwei said:
Created an attachment (id=3)
A patch for the improvement

@glassfishrobot
Copy link
Contributor Author

ozgwei said:
Attached is a patch that allows the combination of 3 different types of
constructors:

  1. constructor with only mandatory/required elements/attributes with no default
    value
  2. constructor with only mandatory/required elements/attributes
  3. the original fully initializing constructor (which can be generated being
    annotated by @deprecated)

See the test target in the build.xml for usage.

Alex

@glassfishrobot
Copy link
Contributor Author

This issue was imported from java.net JIRA JAXB2_COMMONS-11

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant