Want to know, having a class without any annotation, how the jaxb unmarshall the xml data to class.
I found it can take the following
If I have an node "label" in the xml
I have "_label" field in the class and "getLabel" and "setLabel" method.
jaxb can unmarshall it sucsessully. Just want to know 开发者_JS百科its default rule.
The following is from the JAXB 2 specification (JSR-222):
8.12 Default Mapping
This section describes the default mapping of program elements. The default mapping is specified in terms of default annotations that are considered to apply to a program element even in their absence.
8.12.1 Java Identifier To XML Name
The following is the default mapping for different identifiers:
- class name: a class name is mapped to an XML name by de capitalization using java.beans.Introspector.decapitalize(class name ).
- enumtype name: enumtype name is mapped to an XML name by de capitalization using java.beans.Introspector.decapitalize(enumtype name).
- A property name (e.g. address) is derived from JavaBean access method (e.g. getAddress) by JavaBean de capitalization of the JavaBean property name java.beans.Introspector.decapitalize(JavaBeanAcc essMethod)
精彩评论