users@jaxb.java.net

Re: Typesafe enum - size limit?

From: Wolfgang Laun <wolfgang.laun_at_gmail.com>
Date: Sun, 8 Nov 2009 16:26:51 +0100

For your (and the list's) information, I've created an issue which should
(from version 2.2.1 onwards) produce an informative warning if the
256-enumeration threshold is exceeded without a customization raising this
limit. Then, at least, users will be informed what to do.

(Sadly, the limit has been defined in the JAXB spec, so that a more
user-friendly solution is not feasible.)

-W

On Sun, Nov 8, 2009 at 2:48 PM, ofira shaer <oshaer_at_gmail.com> wrote:

> Thanks a lot. it seems to have solved the problem.
>
> 2009/11/4, Wolfgang Laun <wolfgang.laun_at_gmail.com>:
>
>> Well, JAXB does not "refuse to generate the Java code" - it just creates
>> code where the type of the enumeration restricted element is
>> java.lang.String.
>>
>> To force the generation of an enum even when there are more than 256
>> enumeration facets to a xs:String type you have to add a customization to
>> your <xs:schema> element:
>>
>> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
>> xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
>> jaxb:version="2.0">
>> <xs:annotation>
>> <xs:appinfo>
>> <jaxb:globalBindings typesafeEnumMaxMembers="1000"/>
>> </xs:appinfo
>> </xs:annotation>
>> ...
>> </xs:schema>
>>
>> (Or you can use an external bindings file.)
>> -W
>>
>>
>>
>> On Tue, Nov 3, 2009 at 5:05 PM, ofira shaer <oshaer_at_gmail.com> wrote:
>>
>>> xjc.bat -version
>>> xjc version "hudson-jaxb-ri-2.2-34"
>>> JavaTM Architecture for XML Binding(JAXB) Reference Implementation,
>>> (build hudso
>>> n-jaxb-ri-2.2-34)
>>>
>>> Yes. I run it this way and got the same: xjc.bat -verbose -cp .
>>> testOfSchema.xsd
>>>
>>> Thanks again.
>>>
>>>
>>>
>>>
>>> 2009/11/3, Wolfgang Laun <wolfgang.laun_at_gmail.com>:
>>>
>>>> What is the xjc version?
>>>>
>>>> What, exactly, is the error message?
>>>>
>>>> Does the error also occur if you compile just the simple type with 256
>>>> enums and omit all the plugins?
>>>>
>>>> -W
>>>>
>>>>
>>>>
>>>> On Tue, Nov 3, 2009 at 4:42 PM, ofira shaer <oshaer_at_gmail.com> wrote:
>>>>
>>>>> Hi.
>>>>>
>>>>> It seems that it has nothing to do with typesafe enum, but I have a
>>>>> problem with enum's generally.
>>>>> Please see the attached file
>>>>>
>>>>> If I add "field_257", the java code is not created. If "Fields" ends
>>>>> with "field_256", the code is created.
>>>>>
>>>>> The command line I use is:
>>>>>
>>>>> xjc.bat -verbose -cp
>>>>> .;defaultvalueplugin.jar;jaxb-2.0-xjc-value-constructor-plugin.jar
>>>>> -Xinject-code -Xdefault-value -d C:\mydir testOfSchema.xsd
>>>>>
>>>>> What am I missing here?
>>>>>
>>>>> Thanks.
>>>>>
>>>>>
>>>>> 2009/11/1, Wolfgang Laun <wolfgang.laun_at_gmail.com>:
>>>>>
>>>>>> xjc version "JAXB 2.1.10" compiles > 256 <xs:enumeration> without
>>>>>> complaining.
>>>>>>
>>>>>> What's your Schema code?
>>>>>>
>>>>>> -W
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Sun, Nov 1, 2009 at 4:54 PM, ofira shaer <oshaer_at_gmail.com> wrote:
>>>>>>
>>>>>>> Hi.
>>>>>>>
>>>>>>> I have defined a type safe enum of 255 members. When I add the 256's
>>>>>>> member, jaxb refuses to create the java code.
>>>>>>> Is there any limit on the enum size?
>>>>>>>
>>>>>>> Thanks.
>>>>>>> Ofira.
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
>>>>> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>