users@jaxb.java.net

Issue with Enum conversion to Java Class

From: Rohit Singh <rohit.singh.gautam_at_gmail.com>
Date: Mon, 24 Nov 2008 13:45:14 +0900

Dear Friends,
                       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:


<xs:simpleType name="enumABC">

<xs:restriction base="xs:token">

<xs:enumeration value="abc1"/>

<xs:enumeration value="abc2"/>

<xs:enumeration value="abc3"/>

<xs:enumeration value="abc4"/>

<xs:enumeration value="abc5"/>

<xs:enumeration value="abc6"/>

<xs:enumeration value="abc7"/>

<xs:enumeration value="abc8"/>

<xs:enumeration value="abc9"/>

<xs:enumeration value="abc10"/>

<xs:enumeration value="abc11"/>

----------------------------------------------

----------------------------------------------

<xs:enumeration value="abc41"/>

</xs:restriction>

</xs:simpleType>



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.



Thanks

- Rohit