users@jaxb.java.net

Re: JAXB, Introspector, BeanInfo and method sigantures

From: Alec Swan <aukcioner_at_yahoo.com>
Date: Wed, 17 May 2006 16:27:14 -0700 (PDT)

I did look through the docs, but wasn't able to find anything helpful.

In reality, the only thing I am trying to accomplish is that for a given schema element, JAXB generates a getter and a setter methods, which respectively return and take the SAME type of objects.

Here is an example: if I have a schema element E with type "xs:boolean" which is optional and has a default value specified, then JAXB will generate the following getter and setter methods for this element:
public boolean getE() {
...
}

public void setE(Boolean v) {
...
}

Note that the getter method returns a primitive type and the setter method takes a wrapper class as a parameter. I need both of these methods to operate on the boolean type.

However, if I change the XML element to have NO default value, but still be optional, then JAXB generates what I want. But I need this element to be optional with a default value.

Any ideas?

Thanks.

Dmitri Colebatch <dim_at_colebatch.com> wrote: Hi

On 5/18/06, Alec Swan wrote:
> Is there a way to force JAXB to generate methods that do NOT take or return
> primitive values as parameters. For example, how do I force JAXB to ALWAYS
> map "boolean" xml type to java.lang.Boolean java type?
>
> Also, does anybody have any ideas on the following?

Not me sorry - I assume you've looked through the binding file option?
 I would have guessed that you might be able to override it there, but
I've never tried to do what you're doing.

Good luck!

cheers
dim

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net