On Fri, Oct 27, 2017 at 3:43 PM, Garrett Dewald <[email protected]>
wrote:

> Is there a way to disable an @XmlJavaTypeAdapter field annotation via a
> Mixin?
>

Since mix-ins are applied without considering type or semantics, it should
be possible to mask with a new mix-in.
But I don't know if there are values for that annotation that could imply
"no-op" or "ignore".


>
> The only solution I found was writing my own noop adapter to override the
> one defined on the source class, and annotate the Mixin with
> @XmlJavaTypeAdapter(NoopXmlAdapter.class).
>
> Adapter code:
>
> public class NoopXmlAdapter extends XmlAdapter<Object, Object > {
>     public Object unmarshal(Object value) {
>         return value;
>     }
>
>     public Object marshal(Object value) {
>         return value;
>     }
>
>     public NoopXmlAdapter() {}
> }
>
>
It could be that's the only way at this point. If there was a way to
reliably detect do-nothing case, code could be modified.
But Annotation types are quite limited, and obviously we can't modify
@XmlJavaTypeAdapter definition (to add, say, `enabled` property).

Another possibility you could consider would be sub-classing of
JaxbAnnotationIntrospector to explicitly block introspection;
that might work depending on your use case.

-+ Tatu +-



>
> --
> You received this message because you are subscribed to the Google Groups
> "jackson-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"jackson-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to