background image

Typesafe Enumeration Binding Declarations

<< Syntax for the javaType customization | JCustomization Namespace Prefix >>
<< Syntax for the javaType customization | JCustomization Namespace Prefix >>
C
USTOMIZATION
O
VERVIEW
47
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
type-
safe enum
classes.
·
<typesafeEnumMember>
lets you map just selected members of a
simple-
Type
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 Global Binding Declarations (page 42).
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.
·
<javadoc>
customizes the Javadoc tool annotations for the enumeration
class.
· You can have zero or more
<typesafeEnumMember>
declarations embed-
ded in a
<typesafeEnumClass>
declaration.
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.