[prev in list] [next in list] [prev in thread] [next in thread]
List: xmlbeans-dev
Subject: Re: Enumerated types base index
From: "Jacob Danner" <jacob.danner () gmail ! com>
Date: 2007-07-17 15:19:37
Message-ID: bb04eb0a0707170819i38840424x3bd839a1b245bdb1 () mail ! gmail ! com
[Download RAW message or body]
Hi Jason,
I'm not sure why this is the case, but if its really an issue, I think
you could modify the generated src or modify your index to start at
one.
static final int INT_FOO = 1;
static final int INT_BAZ = 2;
I've attached an example src file in case you wanted to peek at it.
I've never needed an Enum value to have a int val beginning at zero
switch(enumVal)
case Enum.INT_FOO:
doSomething();
break;
// ....
And so using this code, I do not need the enumeration value to be a
specific int. This also makes the code a little easier to read as
well.
Hope this helps,
-Jacob Danner
On 7/17/07, Green, Jason M. <jason.green@ngc.com> wrote:
>
>
>
> Hey all,
> I have been attempting to use the Enum.forInt method for some of my
> enumerated types. I am passing in a value that is provided in a text file.
> Often times the value is zero, but when I pass that in, I get a
> XmlValueNotNillableException. I know what this means, but I am confused as
> to why the enumerated values would start at 1 and not 0. In the schema,
> there is obv no numberign associated. Since nearly every language that I
> know of is 0 based, why would this be 1 based? Is there a way to change
> this?
>
> Thanks,
>
> Jason
["TextEnum.java" (application/octet-stream)]
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic