Re: [Simple-support] Mapping of enum value
Brought to you by:
niallg
|
From: Niall G. <gal...@ya...> - 2012-03-15 09:07:51
|
Hi,
Create an Enum Transform, for example take a look at the test cases, you should see.
class EnumTransform implements Transform { // etc..}
A Transform is resolved using a Matcher. Search through the mail archives also, there was a similar question asked some time ago.
Thanks,Niall
--- On Thu, 15/3/12, Siao-Jie,Tsai <dre...@gm...> wrote:
From: Siao-Jie,Tsai <dre...@gm...>
Subject: [Simple-support] Mapping of enum value
To: sim...@li...
Received: Thursday, 15 March, 2012, 1:56 AM
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>
-----Inline Attachment Follows-----
------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
-----Inline Attachment Follows-----
_______________________________________________
Simple-support mailing list
Sim...@li...
https://lists.sourceforge.net/lists/listinfo/simple-support
|