Hi.
> I have an issue with Enum conversion to Java Class. I
> am using JAXB Compiler version jaxb-ri-20071219. I tried to use it to
> convert an XML schema containing an enum. I found that when the enum length
> is equal to or less than 38, it gives the expected output but if the enum
> length exceeds from 38, it automatically converts it to 'String' data type.
>
> Below is the example:
...
> when I tried to refer this Enum in another one (given bleow)----
>
> <element name="enumABCName" type="enumABC" />
>
> In generated Java Code, the compiler should give following output---------
>
> protected enumABC enumABCName;
>
> but it gives the output as following:
>
> @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
>
> protected String enumABCName;
>
> Can anyone please tell me the reason behind it, and how to get rid of this
> kind of unexpected behavior from the compiler.
The reason is that enum lists may long, very long. And from certain
size it may make no sense to generate enums. Current versions have a
limitation ~256 enums by default.
If you need to make sure that enums are generated in your case, not
string, you may do the following:
1. Use the typesafeEnumMaxMembers attribute of the global binding element.
2. Use the typesafeEnumClass customization element.
Bye.
/lexi
Bye.
/lexi