XmlOptionsFactoryBean initializes empty XmlOptions by default and uses efficient entrySet iteration
Issue: SPR-12383
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2012 the original author or authors.
|
* Copyright 2002-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -30,6 +30,7 @@ import org.springframework.beans.factory.FactoryBean;
|
|||||||
* in the {@link XmlBeansMarshaller}.
|
* in the {@link XmlBeansMarshaller}.
|
||||||
*
|
*
|
||||||
* @author Arjen Poutsma
|
* @author Arjen Poutsma
|
||||||
|
* @author Juergen Hoeller
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
* @see XmlOptions
|
* @see XmlOptions
|
||||||
* @see #setOptions(java.util.Map)
|
* @see #setOptions(java.util.Map)
|
||||||
@@ -37,7 +38,7 @@ import org.springframework.beans.factory.FactoryBean;
|
|||||||
*/
|
*/
|
||||||
public class XmlOptionsFactoryBean implements FactoryBean<XmlOptions> {
|
public class XmlOptionsFactoryBean implements FactoryBean<XmlOptions> {
|
||||||
|
|
||||||
private XmlOptions xmlOptions;
|
private XmlOptions xmlOptions = new XmlOptions();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -51,8 +52,8 @@ public class XmlOptionsFactoryBean implements FactoryBean<XmlOptions> {
|
|||||||
public void setOptions(Map<String, ?> optionsMap) {
|
public void setOptions(Map<String, ?> optionsMap) {
|
||||||
this.xmlOptions = new XmlOptions();
|
this.xmlOptions = new XmlOptions();
|
||||||
if (optionsMap != null) {
|
if (optionsMap != null) {
|
||||||
for (String option : optionsMap.keySet()) {
|
for (Map.Entry<String, ?> option : optionsMap.entrySet()) {
|
||||||
this.xmlOptions.put(option, optionsMap.get(option));
|
this.xmlOptions.put(option.getKey(), option.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user