Closed glassfishrobot closed 16 years ago
Reported by ozgwei
ozgwei said: Created an attachment (id=4) A patch for the improvement
hchar said: reassigned to the owner of the fluent api plugin
hchar said: ditto
hchar said: Looking into this. Thanks for the suggestion and patch!
hchar said: Some minor modification and checked in the code changes to CVS. Will arrange a release later on.
hchar said: 2.1.8 released.
File: fluent-api-patch.txt Attached By: ozgwei
Was assigned to hchar
This issue was imported from java.net JIRA JAXB2_COMMONS-12
Marked as fixed on Sunday, October 12th 2008, 2:15:40 am
Currently when an element has maxOccurs > 1, the fluent-api plugin generates a withXxx method that accepts a vararg, such as: public TypeA withXxx(String... values) { if (values != null) { for (String value : values)
{ getXxx().add(value); }
} return this; }
This can be inconvenient if you happen to have a Collection instead of an array or predefined inputs.
Often I have to call like this: new TypeA() .withXxx((String[])xxxList.toArray(new String[xxxList.size()]));
So I propose an improvement to overload this method to accept a Collection as well: public TypeA withXxx(Collection xxx) {
if (xxx != null)
{ getXxx().addAll(xxx); }
return this; }
Cheers, Alex
Environment
Operating System: All Platform: All
Affected Versions
[current]