Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to map the enum in Castor XML

 
Aleks Eustace
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 649
3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1
Eclipse IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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>
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic