highsource / jaxb2-basics

Useful plugins and tools for JAXB2.
BSD 2-Clause "Simplified" License
109 stars 54 forks source link

Pluralize names of simplified-out lists #18

Closed borismarin closed 9 years ago

borismarin commented 9 years ago

The simplify plugin generates

protected List<FooType> foo; // foo is singular
protected List<BarType> far; // bar is singular

from the complex property

<xs:choice maxOccurs="unbounded">
    <xs:element name="foo" type="FooType"/>
    <xs:element name="far" type="BarType"/>
</xs:choice>

Would it be possible to generate "pluralized" lists (similarly to what simpler&better binding mode does), i.e.

protected List<FooType> foos; // Notice fooS instead of Foo
protected List<BarType> bars;  // Notice barS instead of Bar

?

highsource commented 9 years ago

Sure.

But I'll also have to add an option to disable plural form to allow backwards compatibility.

highsource commented 9 years ago

Implemented, but must be documented:

https://github.com/highsource/jaxb2-basics/wiki/JAXB2-Simplify-Plugin

borismarin commented 9 years ago

Wow, that was fast! Wouldn't it be better to default to singular, and trigger plurals by using the flag?

highsource commented 9 years ago

I also thought about it. The question is usability for future users vs. backwards compatibility for existing users. I think you're right. Backwards compatibility is more important. I'll make usePluralForm false by default.

borismarin commented 9 years ago

I have added a section on options/pluralization to the docs. Once you decide how to enable/disable pluralization, it must be updated accordingly.

highsource commented 9 years ago

I think it's better to disable the pluralization by default. Implemented now.

Documentation:

Would it be OK to credit you in the release notes?

Thank you very much for your contribution!

borismarin commented 9 years ago

No worries, you are the one who did all the hard work... I've made a small change to the code snippets on the docs (the 'children' list and the type for 'foot' where missing).

Thanks!

On 6 January 2015 at 21:20, Alexey Valikov notifications@github.com wrote:

Closed #18 https://github.com/highsource/jaxb2-basics/issues/18.

Reply to this email directly or view it on GitHub https://github.com/highsource/jaxb2-basics/issues/18#event-214938537.

borismarin commented 9 years ago

@highsource any idea when 0.9.3 will make it to the mvn repo?

highsource commented 9 years ago

@borismarin It is released now, should appear in the central within an hour.

borismarin commented 9 years ago

Great!

On 24 January 2015 at 08:16, Alexey Valikov notifications@github.com wrote:

@borismarin https://github.com/borismarin It is released now, should appear in the central within an hour.

Reply to this email directly or view it on GitHub https://github.com/highsource/jaxb2-basics/issues/18#issuecomment-71304881 .