how java jaxb works?

前端 未结 2 1525
渐次进展
渐次进展 2021-01-18 18:42

Just curious about how jaxb works, I have a class annotated as follows:

@XmlRootElement(name = \"MyJaxb\")
Class MyJaxb
{
      @XmlElement
      protected S         


        
2条回答
  •  梦谈多话
    2021-01-18 18:54

    It uses reflection. A protected or private field or method can be accessed using the reflection API (using setAccessible(true) on the appropriate Field or Method object).

    Remember - public, protected and private are controls on default visibility, nothing more. They do not (and cannot) prevent access using reflection.

提交回复
热议问题