users@jaxb.java.net

Re: Plugin to change JAXB 2.0 default values behavior

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Thu, 08 Sep 2005 16:26:12 -0700

Scott Allan wrote:
> Thanks. I got it working so far. Now that I have the default value and
> the JFieldVar I want to init, I just need set the JExpression so that it
> works with all primitive and class types such as:
>
> I think you indicated that TypeUse.createConstant could do this for me?

Yes.

> Could you please give me an example of how to use this method?

I expanded javadoc on ElementPropertyInfo and TypeRef to talk about this
area a bit more. I also changed some of the relevant code so that the
default value and its associated namespace context can be passed around
more transparently.

As a result, you only need to:

   CTypeRef tr = ...;
   tr.getTarget().createConstant(model.codeModel, tr.defaultValue );


-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com