[Simple-support] Mapping of enum value
Brought to you by:
niallg
|
From: Siao-Jie,Tsai <dre...@gm...> - 2012-03-15 08:56:34
|
Dear All:
Dear all:
I want to map a XML element's value to a enum,
but the value of the enum in XML schema is all defined in lower case: like "atomic", "collection".
So I wrote something like this, and it works:
@Element(name="value")
@Path("structure")
public Structure structure;
public enum Structure
{
atomic, collection, linear
}
<structure>
<source>LOMv1.0</source>
<value>atomic</value>
</structure>
But can I have something like this? and write some mapping code to map "atomic" to "ATOMIC" ?
@Element(name="value")
@Path("structure")
public Structure structure;
public enum Structure
{
ATOMIC, COLLECTION, LINEAR
}
<structure>
<source>LOMv1.0</source>
<value>atomic</value>
</structure> |