From 68804a45cd6eb5b8cb06f2f5a0f700043766a0f6 Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Fri, 2 Apr 2021 12:26:03 -0700 Subject: [PATCH] Further clean up wrt #462 --- .../xml/JacksonXmlAnnotationIntrospector.java | 18 ++++++++++++------ .../xml/XmlAnnotationIntrospector.java | 15 --------------- .../jackson/dataformat/xml/XmlMapper.java | 4 ++-- .../jaxb/XmlJaxbAnnotationIntrospector.java | 5 ----- 4 files changed, 14 insertions(+), 28 deletions(-) diff --git a/src/main/java/com/fasterxml/jackson/dataformat/xml/JacksonXmlAnnotationIntrospector.java b/src/main/java/com/fasterxml/jackson/dataformat/xml/JacksonXmlAnnotationIntrospector.java index a6534f30d..be89ce3b5 100644 --- a/src/main/java/com/fasterxml/jackson/dataformat/xml/JacksonXmlAnnotationIntrospector.java +++ b/src/main/java/com/fasterxml/jackson/dataformat/xml/JacksonXmlAnnotationIntrospector.java @@ -14,7 +14,8 @@ * additional xml-specific annotation that Jackson provides. Note, however, that * there is no JAXB annotation support here; that is provided with * separate introspector (see - * {@link com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector}). + * https://github.com/FasterXML/jackson-modules-base/tree/master/jaxb, + * class {@code com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector}). */ public class JacksonXmlAnnotationIntrospector extends JacksonAnnotationIntrospector @@ -46,6 +47,16 @@ public JacksonXmlAnnotationIntrospector(boolean defaultUseWrapper) { _cfgDefaultUseWrapper = defaultUseWrapper; } + /* + /********************************************************************** + /* Extended API XML format module requires + /********************************************************************** + */ + + public void setDefaultUseWrapper(boolean b) { + _cfgDefaultUseWrapper = b; + } + /* /********************************************************************** /* Overrides of JacksonAnnotationIntrospector impls @@ -148,11 +159,6 @@ public Boolean isOutputAsCData(MapperConfig config, Annotated ann) { return null; } - @Override - public void setDefaultUseWrapper(boolean b) { - _cfgDefaultUseWrapper = b; - } - /* /********************************************************************** /* Overrides for name, property detection diff --git a/src/main/java/com/fasterxml/jackson/dataformat/xml/XmlAnnotationIntrospector.java b/src/main/java/com/fasterxml/jackson/dataformat/xml/XmlAnnotationIntrospector.java index 77c0ddd1c..da08819a8 100644 --- a/src/main/java/com/fasterxml/jackson/dataformat/xml/XmlAnnotationIntrospector.java +++ b/src/main/java/com/fasterxml/jackson/dataformat/xml/XmlAnnotationIntrospector.java @@ -12,11 +12,6 @@ public interface XmlAnnotationIntrospector extends AnnotationIntrospector.XmlExtensions { - /** - * @since 2.7 - */ - public void setDefaultUseWrapper(boolean b); - /* /********************************************************************** /* Replacement of 'AnnotationIntrospector.Pair' to use when combining @@ -94,15 +89,5 @@ public Boolean isOutputAsCData(MapperConfig config, Annotated ann) { } return value; } - - @Override - public void setDefaultUseWrapper(boolean b) { - if (_xmlPrimary instanceof XmlAnnotationIntrospector) { - ((XmlAnnotationIntrospector)_xmlPrimary).setDefaultUseWrapper(b); - } - if (_xmlSecondary instanceof XmlAnnotationIntrospector) { - ((XmlAnnotationIntrospector)_xmlSecondary).setDefaultUseWrapper(b); - } - } } } diff --git a/src/main/java/com/fasterxml/jackson/dataformat/xml/XmlMapper.java b/src/main/java/com/fasterxml/jackson/dataformat/xml/XmlMapper.java index 4955f6bfc..91826182e 100644 --- a/src/main/java/com/fasterxml/jackson/dataformat/xml/XmlMapper.java +++ b/src/main/java/com/fasterxml/jackson/dataformat/xml/XmlMapper.java @@ -264,8 +264,8 @@ public XmlMapper setDefaultUseWrapper(boolean state) { // ser and deser configs should usually have the same introspector, so: AnnotationIntrospector ai0 = getDeserializationConfig().getAnnotationIntrospector(); for (AnnotationIntrospector ai : ai0.allIntrospectors()) { - if (ai instanceof XmlAnnotationIntrospector) { - ((XmlAnnotationIntrospector) ai).setDefaultUseWrapper(state); + if (ai instanceof JacksonXmlAnnotationIntrospector) { + ((JacksonXmlAnnotationIntrospector) ai).setDefaultUseWrapper(state); } } return this; diff --git a/src/main/java/com/fasterxml/jackson/dataformat/xml/jaxb/XmlJaxbAnnotationIntrospector.java b/src/main/java/com/fasterxml/jackson/dataformat/xml/jaxb/XmlJaxbAnnotationIntrospector.java index 26729dff5..14980b220 100644 --- a/src/main/java/com/fasterxml/jackson/dataformat/xml/jaxb/XmlJaxbAnnotationIntrospector.java +++ b/src/main/java/com/fasterxml/jackson/dataformat/xml/jaxb/XmlJaxbAnnotationIntrospector.java @@ -59,9 +59,4 @@ public Boolean isOutputAsText(MapperConfig config, Annotated ann) { public Boolean isOutputAsCData(MapperConfig config, Annotated ann) { return null; } - - @Override - public void setDefaultUseWrapper(boolean b) { - // nothing to do with JAXB - } }