This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes How to map the enum in Castor XML Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "How to map the enum in Castor XML" Watch "How to map the enum in Castor XML" New topic
Author

How to map the enum in Castor XML

Aleks Eustace
Greenhorn

Joined: Jun 20, 2013
Posts: 6
Hello brothers.
Please advice what way can I map a class if it contains the field enum.
I use Castor XML.
Thanks in advance.
g tsuji
Ranch Hand

Joined: Jan 18, 2011
Posts: 583
    
    3
map a class if it contains the field enum


a class: named EnumContainer mapped to enum-container element
a field: named fieldEnum of Enum SimpleEnum (of bare minimal Enum) mapped to field-enum element

The child block <class> within the <mapping> of the mapping file would look something like this.

Potential to get more involved, but that's the bare minimal construction.
giridhar rayala
Greenhorn

Joined: Feb 28, 2011
Posts: 1

Little too late, but helps on going searchers

https://www.mail-archive.com/user@castor.codehaus.org/msg07422.html

public enum Type {

ABC, VDR, ICZ;

}

>>>>> And here's the relevant part of my mapping:

<field name="type" type="com.mycompany.Type">
<bind-xml name="cv:type" node="element"
xmlns:cv="http://www.mycompany.com/Type"; />
</field>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to map the enum in Castor XML
 
It's not a secret anymore!