HeruMartinus.Salim_at_infineon.com wrote:
> Thanks Kohsuke,
>
> Problem about this co-variant return type is solved, but I think it
> doesn't work for returning the List of co-variant types.
Indeed. Good point.
> I didn't get what you mean by out-of-box option. Is there then any way
> to do this? Using in-the-box option? (sorry if I miss-using the term).
Maybe I misused the term. I meant "out of the box", which means there's
no handy command line option nor customization that you can use right
after you downloaded the RI.
Instead you'd have to write a plugin. You need to write a custom Field
class by copying UntypedListField and changing it (so that it returns
co-variant return type), then create the equivalent of
UntypedListFieldRenderer for your UntypedListField, then write a custom
FieldRendererFactory to override FieldRendererFactory.getList, then
finally set that custom instance to the Options object.
>
> Regards,
> Heru
>
> -----Original Message-----
> From: Kohsuke Kawaguchi [mailto:Kohsuke.Kawaguchi_at_Sun.COM]
> Sent: Friday, October 27, 2006 7:34 PM
> To: users_at_jaxb.dev.java.net
> Subject: Re: Disable generating getter method
>
> HeruMartinus.Salim_at_infineon.com wrote:
>> I had a problem that my generated codes have a getter methods which
>> returning of the type of the generated classes (which is normal).
>> And now I'm making a wrapper of these classes (which is the
>> subclasses), I have problem while I must returning the classes of the
>> wrappers. But when I try to override the getter methods, there are
>> compile error that I cannot return different type when overriding.
>
> JDK5 supports co-variant return type, so you should be able to override
> the getter method to return a subtype. Can you cite a relevant portion
> of the source code and error message?
>
>> Or should I disable the generating of getter method? How to do it on
>> the customization? I've looked to the documentation, but cannot find
>> the expected part.
>
> There's no out-of-box option to disable a getter generation, in short of
> writing a plugin.
>
> --
> Kohsuke Kawaguchi
> Sun Microsystems kohsuke.kawaguchi_at_sun.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>
--
Kohsuke Kawaguchi
Sun Microsystems kohsuke.kawaguchi_at_sun.com