users@jaxb.java.net

Re: hashCode and equals methods in generated classes

From: Kenny MacLeod <kennym_at_kizoom.com>
Date: Fri, 27 Oct 2006 08:28:11 +0100

Hi Hanson. May I suggest yet another impertinent enhancement on one of
your plugins? :-)

In the case of the generated equals method, the plugin could take an
option parameter in XJC which indicates the static field which is a
reference to the ToStringStyle you want to use, in a similar way to
xjc:javaType takes references to print and parse static methods in a
binding customisation. If the option isn't supplied, then just fallback
to the default style.

Alternatively, or even additionally, you could generate an additional
toString() method which takes a ToStringStyle parameter, which would
allow you to override it at runtime.

The reason I suggest these is that it's notoriously trickly to pick a
ToStringStyle that works with every object model and every application.



Hanson Char wrote:
> https://jaxb2-commons.dev.java.net/commons-lang-plugin/
>
> On 10/26/06, Art <ainfo_at_patteran.com> wrote:
>> Has anyone else developed a solution for generating equals and hashCode
>> methods inside the generated classes since subclasses aren't an option:
>>
>> http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6350739
>>
>> -Art
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
>> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>