Skip to content

Commit

Permalink
Further clean up wrt #462
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Apr 2, 2021
1 parent 5887e81 commit 68804a4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

0 comments on commit 68804a4

Please sign in to comment.