Update clone() method so that default constructor does not need to be changed

This commit is contained in:
Keaton Taylor 2023-11-22 11:14:50 +02:00
parent 30f5b2de79
commit 09f35372d4

View File

@ -156,14 +156,13 @@ public class XMLParserConfiguration extends ParserConfiguration {
*/ */
private XMLParserConfiguration (final boolean keepStrings, final String cDataTagName, private XMLParserConfiguration (final boolean keepStrings, final String cDataTagName,
final boolean convertNilAttributeToNull, final Map<String, XMLXsiTypeConverter<?>> xsiTypeMap, final Set<String> forceList, final boolean convertNilAttributeToNull, final Map<String, XMLXsiTypeConverter<?>> xsiTypeMap, final Set<String> forceList,
final int maxNestingDepth, final boolean closeEmptyTag, final boolean shouldTrimWhiteSpace) { final int maxNestingDepth, final boolean closeEmptyTag) {
super(keepStrings, maxNestingDepth); super(keepStrings, maxNestingDepth);
this.cDataTagName = cDataTagName; this.cDataTagName = cDataTagName;
this.convertNilAttributeToNull = convertNilAttributeToNull; this.convertNilAttributeToNull = convertNilAttributeToNull;
this.xsiTypeMap = Collections.unmodifiableMap(xsiTypeMap); this.xsiTypeMap = Collections.unmodifiableMap(xsiTypeMap);
this.forceList = Collections.unmodifiableSet(forceList); this.forceList = Collections.unmodifiableSet(forceList);
this.closeEmptyTag = closeEmptyTag; this.closeEmptyTag = closeEmptyTag;
this.shouldTrimWhiteSpace = shouldTrimWhiteSpace;
} }
/** /**
@ -176,16 +175,17 @@ public class XMLParserConfiguration extends ParserConfiguration {
// item, a new map instance should be created and if possible each value in the // item, a new map instance should be created and if possible each value in the
// map should be cloned as well. If the values of the map are known to also // map should be cloned as well. If the values of the map are known to also
// be immutable, then a shallow clone of the map is acceptable. // be immutable, then a shallow clone of the map is acceptable.
return new XMLParserConfiguration( final XMLParserConfiguration config = new XMLParserConfiguration(
this.keepStrings, this.keepStrings,
this.cDataTagName, this.cDataTagName,
this.convertNilAttributeToNull, this.convertNilAttributeToNull,
this.xsiTypeMap, this.xsiTypeMap,
this.forceList, this.forceList,
this.maxNestingDepth, this.maxNestingDepth,
this.closeEmptyTag, this.closeEmptyTag
this.shouldTrimWhiteSpace
); );
config.shouldTrimWhiteSpace = this.shouldTrimWhiteSpace;
return config;
} }
/** /**