Fuse 6 is no longer supported
As of February 2025, Red Hat Fuse 6 is no longer supported. If you are using Fuse 6, please upgrade to Red Hat build of Apache Camel.Este conteúdo não está disponível no idioma selecionado.
36.4. Customizing Enumeration Mapping
Overview Copiar o linkLink copiado para a área de transferência!
jaxb:typesafeEnumClass
element along with one or more jaxb:typesafeEnumMember
elements.
globalBindings
customization.
Member name customizer Copiar o linkLink copiado para a área de transferência!
globalBinding
element's typesafeEnumMemberName
attribute. The typesafeEnumMemberName
attribute's values are described in Table 36.2, “Values for Customizing Enumeration Member Name Generation”.
Value | Description |
---|---|
skipGeneration (default) | Specifies that the Java enum type is not generated and generates a warning. |
generateName | Specifies that member names will be generated following the pattern VALUE_N . N starts off at one, and is incremented for each member of the enumeration. |
generateError | Specifies that the code generator generates an error when it cannot map an enumeration to a Java enum type. |
Example 36.17. Customization to Force Type Safe Member Names
Class customizer Copiar o linkLink copiado para a área de transferência!
jaxb:typesafeEnumClass
element specifies that an XML Schema enumeration should be mapped to a Java enum type. It has two attributes that are described in Table 36.3, “Attributes for Customizing a Generated Enumeration Class”. When the jaxb:typesafeEnumClass
element is specified in-line, it must be placed inside the xsd:annotation
element of the simple type it is modifying.
Attribute | Description |
---|---|
name | Specifies the name of the generated Java enum type. This value must be a valid Java identifier. |
map | Specifies if the enumeration should be mapped to a Java enum type. The default value is true . |
Member customizer Copiar o linkLink copiado para a área de transferência!
jaxb:typesafeEnumMember
element specifies the mapping between an XML Schema enumeration
facet and a Java enum type constant. You must use one jaxb:typesafeEnumMember
element for each enumeration
facet in the enumeration being customized.
- It can be placed inside the
xsd:annotation
element of theenumeration
facet it is modifying. - They can all be placed as children of the
jaxb:typesafeEnumClass
element used to customize the enumeration.
jaxb:typesafeEnumMember
element has a name
attribute that is required. The name
attribute specifies the name of the generated Java enum type constant. It's value must be a valid Java identifier.
jaxb:typesafeEnumMember
element also has a value
attribute. The value
is used to associate the enumeration
facet with the proper jaxb:typesafeEnumMember
element. The value of the value
attribute must match one of the values of an enumeration
facets' value
attribute. This attribute is required when you use an external binding specification for customizing the type generation, or when you group the jaxb:typesafeEnumMember
elements as children of the jaxb:typesafeEnumClass
element.
Examples Copiar o linkLink copiado para a área de transferência!
Example 36.18. In-line Customization of an Enumerated Type
Example 36.19. In-line Customization of an Enumerated Type Using a Combined Mapping
Example 36.20. Binding File for Customizing an Enumeration