background image

Typesafe Enumeration Binding Declarations

<< javaType Binding Declarations | javadoc Binding Declarations >>
<< javaType Binding Declarations | javadoc Binding Declarations >>

Typesafe Enumeration Binding Declarations

A <property> declaration
See
"MyDatatypeConverter Class" on page 530
for an example of how <javaType> declarations
and the DatatypeConverterInterface interface are implemented in a custom data type
converter class.
Typesafe Enumeration Binding Declarations
The typesafe enumeration declarations provide a localized way to map XML simpleType
elements to Java typesafe enum classes. There are two types of typesafe enumeration
declarations you can make:
<typesafeEnumClass>
lets you map an entire simpleType class to typesafe enum classes.
<typesafeEnumMember>
lets you map just selected members of a simpleType class to
typesafe enum
classes.
In both cases, there are two primary limitations on this type of customization:
Only simpleType definitions with enumeration facets can be customized using this binding
declaration.
This customization only applies to a single simpleType definition at a time. To map sets of
similar simpleType definitions on a global level, use the typesafeEnumBase attribute in a
<globalBindings>
declaration, as described in
"Global Binding Declarations" on page 519
.
The syntax for the <typesafeEnumClass> customization is:
<typesafeEnumClass
[ name =
"enumClassName" ]
[ <typesafeEnumMember> ... </typesafeEnumMember> ]*
[ <javadoc> enumClassJavadoc </javadoc> ]
</typesafeEnumClass>
name
must be a legal Java Identifier, and must not have a package prefix.
You can have zero or more <typesafeEnumMember> declarations embedded in a
<typesafeEnumClass>
declaration.
<javadoc>
customizes the Javadoc tool annotations for the enumeration class.
The syntax for the <typesafeEnumMember> customization is:
<typesafeEnumMember name =
"enumMemberName">
[ value =
"enumMemberValue" ]
[ <javadoc> enumMemberJavadoc </javadoc> ]
</typesafeEnumMember>
name
must always be specified and must be a legal Java identifier.
value
must be the enumeration value specified in the source schema.
<javadoc>
customizes the Javadoc tool annotations for the enumeration constant.
Customizing JAXB Bindings
The Java EE 5 Tutorial · September 2007
524