
Originally Posted by
bytor99999
First are the Strings and ints already int the Enum. Meaning does the int mean the position in the enum, and String being the String representation in the Enum. If so, those methods are already part of an Enum. If not, you can add methods to the Enum to do those conversions for you.
Also, remember a PropertyEditor converts from String to an Object type. So if you want int, you can have it return an Integer instead.
Shame you aren't using Spring 3.x or you could use Spring Expression Language.
I think you need to add more detail as to what you have tried and your configuration.
Mark
The ints are not the positions. They are custom digits set through constructors on the items in the Enum. And I have methods to do the conversion, but I am not sure how to call them. In the context file I am doing something like
Code:
<value type="com.mycompany.CustomEnum">ENUM_ITEM</value>
This is the only way I know how to use the enum from an XML context file.