dev@jaxb.java.net

Re: Make *Fields public

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Tue, 14 Jun 2005 10:55:46 -0700

Aleksei Valikov wrote:
> I have to generate identifier properties for Hibernate. To hold property
> model consistent, I'd like to generate them as CValuePropertyInfos.
> However, generated fields must be @XmlTransient so that they won't be
> processed by JAXB. This means I need something like TransientSingleField:
>
> public class TransientSingleField extends SingleField {
>
> public TransientSingleField(ClassOutlineImpl context, CPropertyInfo
> prop) {
> super(context, prop);
> }
>
>
> protected void annotate(JAnnotatable field) {
>
> field.annotate(XmlTransient.class);
> }
> }

I see, so you are defining your own custom renderer and you want that to
derive from our existing ones.

> To be able to extend SingleField, I need it to be public.
> You're right, I could implement FieldOutline, but this would result in
> copying a lot of the code from SingleField, AbstractField* and so on,
> I'd like to avoid this.

Right.

> I will also need a ProxyField - a field which simply accesses field from
> another property.
>
> Choices are: add TransientSingleField and ProxyField to JAXB or make
> appropriate classes public to allow extensions. I like the last
> alternative a bit better - more freedom in plugins and I don't have to
> hack into JAXB with my field classes.

Yeah I think I agree with you. I was originally concerned that maybe you
are trying to access fields of the existing Fields to do something in
your plugin.

I added package comment that clarifies the intention of making them public.

So if you'd change them, that would be great!

-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com