开发者

JAXB unmarshal exclude specific element

开发者 https://www.devze.com 2022-12-23 02:19 出处:网络
I know for @XmlTransient annotation, but sometimes I need this element and in other use cases I really have to prevent it from unmarshaling, because it contains base6开发者_运维技巧4 text. So I need t

I know for @XmlTransient annotation, but sometimes I need this element and in other use cases I really have to prevent it from unmarshaling, because it contains base6开发者_运维技巧4 text. So I need to exclude it because performance problems.

Is there any way to dynamicly exclude one element from unmarshaling with JAXB?


Maybe it would be enough for you to have non-trivial setter? JAXB would call the setter and inside you would do something like this:

 public void setMyProperty(String myProperty) {
    if (someSpecialBusinessDecision()) { 
        this.myProperty = myProperty;
    }
 }
0

精彩评论

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