tags:

views:

73

answers:

1

Hi everyone!

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 base64 text. So I need to exclude it because performance problems.

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

A: 

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;
    }
 }
Grzegorz Oledzki
I've kinda solve problem differently then, but your answer will also come in handy, so thank you!
zigomir