开发者

JAXB runtime specify what to marshall

Im wondering is there any RUNTIME possibility how to select which fields should be omitted during marshalling. I know that there is @XmlTransient annotation, but that is not runtime.

E.g.

@XmlRootElement
public class Person {

  @XmlElement
  private String name;
  @XmlElement
  private int age;

}

w开发者_运维知识库anting both of those ouputs, but the decision is made runtime:

<person>
  <name>foo</name>
  <age>boo</age>
</person>

<person>
  <name>foo</name>
</person>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜