public class Enum
{
public static final Enum V1 = new Enum ("v1");
public static final Enum V2 = new Enum ("v2");
(...)private String itsName;
private Enum (String aName)
{
itsName = aName;
} // Retrieves the corresponding instance
public static Enum find (String aName) {...}
}I want to map it to <enum name="v1"/> for instance.
And I have class Foo:
class Foo
{
private Enum itsEnum;
}that I want to map to:
<foo>
<enum name="v2"/>
</foo>A possibility would be to add an <enumeration> tag:
<mapping name="foo" class="Foo">
<enumeration name="enum" class="Enum" id-attribute="name" id-field="itsName" factory="find"/>
</mapping>
This specifies that the enum tag will be mapped to the Enum class, the marshalling process will put the value of the "itsName" field into the "name" tag, and the unmarshaller will use the "find" method giving it the content of the "name" attribute as an argument.
How does it sound? Guillaume
------------------------------------------------------- This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek For a limited time only, get FREE Ground shipping on all orders of $35 or more. Hurry up and shop folks, this offer expires April 30th! http://www.thinkgeek.com/freeshipping/?cpg=12297 _______________________________________________ jibx-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jibx-users
