JAXB : Is the annotation @XmlAccessorType is only for Serialization and nothing to do with Binding of data?

后端 未结 1 1388
别那么骄傲
别那么骄傲 2021-01-11 13:18

I wanted to know why do we need to specify the Annotation @XmlAccessorType when working with JAXB .

When i googled for this i found out this description from a web

相关标签:
1条回答
  • 2021-01-11 13:47

    JAXB's @XmlAccessorType annotation is only used by JAXB (JSR-222) implementations for determining how to marshal a file to/from XML:

    Normally the main decision to be made is between FIELD & PROPERTY/PUBLIC. FIELD is particularly useful when you have logic in your get/set methods that you do not want triggered during marshalling/unmarshalling. To see one way this choice affects the mapping metadata see:

    • http://blog.bdoughan.com/2012/02/jaxbs-xmltype-and-proporder.html

    NONE is a useful choice when you have many unmapped properties and you want to tell your JAXB implementation to only map the fields/properties you have annotated. This can be alot easier than adding a lot of @XmlTransient annotations into your model.

    Fore More Information

    • http://blog.bdoughan.com/2011/06/using-jaxbs-xmlaccessortype-to.html
    0 讨论(0)
提交回复
热议问题