JAXB Interviewfragen und Antworten
Frage 16. Discuss Customization Levels.
Customizations can be made at four levels
â global
⢠defined at âtop levelâ in a <jxb:globalBindings> element
⢠applies to all schema elements in the source schema
and in all included/imported schemas (recursively)
â schema
⢠defined at âtop levelâ in a <jxb:schemaBindings> element
⢠applies to all schema elements in the target namespace of the source schema
â definition
⢠defined in a type or global declaration
⢠applies to all schema elements that reference the type or global declaration
â component
⢠defined in a particular schema element or attribute declaration
⢠applies only to it
Frage 17. Discuss Global Bindings attributes.
⢠collectionType
â âindexedâ (uses array and provides methods to get/set elements) or fully-qualified-java-class-name(must implement java.util.List)
â default is âjava.util.ArrayListâ
⢠enableFailFastCheck
â âtrueâ or âfalseâ (default)
â if true, invalid property values are reported as soon as they are set, instead of waiting until validation is requested
â not implemented yet in RI
⢠generateIsSetMethod
â âtrueâ or âfalseâ (default)
â if true, generates isSet and unSet methods for the property
⢠underscoreBinding
â âasCharInWordâ or âasWordSeparatorâ (default)
â if âasWordSeparatorâ , underscores in XML names are removed and words are camel-cased to form Java name
â for example, âgear_shift_knobâ goes to âgearShiftKnobâ
⢠bindingStyle (was modelGroupAsClass)
â âmodelGroupBindingâ or âelementBindingâ (default)
⢠choiceContentProperty
â âtrueâ or âfalseâ (default)
â allows objects to hold one of a number of property choices which may each have a different data type
⢠enableJavaNamingConventions
â âtrueâ (default) or âfalseâ
⢠fixedAttributeAsConstantProperty
â âtrueâ or âfalseâ (default)
â if true, âfixedâ attributes will be represented as constants
⢠typesafeEnumBase
â âxsd:stringâ , âxsd:decimalâ , âxsd:floatâ , âxsd:doubleâ or âxsd:NCNameâ (default)
â defines field type used to represent enumerated values in generated typesafe enum class
⢠typesafeEnumMemberName
â âgenerateNameâ or âgenerateErrorâ (default)
â specifies what to do if an enumerated value cannot be mapped to a valid Java identifier
â âgenerateNameâ generates names in the form VALUE_#
â âgenerateErrorâ reports an error
Frage 18. What is the syntax of schemaBindings?
⢠The syntax for the schemaBindings element is
<jxb:schemaBindings>
<jxb:package [name="package-name"]>
<jxb:javadoc> ... javadoc ... </jxb:javadoc>
</package>
<jxb:nameXmlTransform>
<jxb:typeName prefix="prefix" suffix="suffix"/>
<jxb:elementName prefix="prefix" suffix="suffix"/>
<jxb:modelGroupName prefix="prefix" suffix="suffix"/>
<jxb:anonymousTypeName prefix="prefix" suffix="suffix"/>
</jxb:nameXmlTransform>
</jxb:schemaBindings>
â every element and attribute within schemaBindings is optional
Am hilfreichsten laut Nutzern:
- What Is XML Binding?
- What is XML Binding Relationships?
- Please explain JAXB Use Cases.
- Why Use XML Binding?
- What are the goals of JAXB?