JAXB preguntas y respuestas de entrevista
Pregunta 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
Pregunta 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
Pregunta 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
Lo mas util segun los usuarios:
- What Is XML Binding?
- What is XML Binding Relationships?
- Please explain JAXB Use Cases.
- Why Use XML Binding?
- What are the goals of JAXB?