on 2020 Feb 19 11:00 AM
Hi
i want to create a enum as below but build and eclipse also show i cannot create enum like this with error "cvc-attribute.3: The value '1' of attribute 'code' on element 'value' is not valid with respect to its type, 'enumCodeType'." how to achieve this?
<enumtype code="LocalityType" autocreate="true" generate="true">
<value code="1"/>
<value code="2"/>
<value code="3"/>
<value code="4"/>
</enumtype>
Request clarification before answering.
Enums in Java cannot be numbers. You need to name them like this
<enumtype code="LocalityType" autocreate="true" generate="true">
<value code="ONE"/>
<value code="TWO"/>
<value code="THREE"/>
<value code="FOUR"/>
</enumtype>
As it is an Enum you can then use the ordinal that is specifying the Position.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
12 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.