added chaining-capable "add" method to MutablePropertyValues
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -47,9 +47,8 @@ public class MutablePropertyValues implements PropertyValues, Serializable {
|
||||
|
||||
/**
|
||||
* Creates a new empty MutablePropertyValues object.
|
||||
* Property values can be added with the <code>addPropertyValue</code> methods.
|
||||
* @see #addPropertyValue(PropertyValue)
|
||||
* @see #addPropertyValue(String, Object)
|
||||
* <p>Property values can be added with the <code>add</code> method.
|
||||
* @see #add(String, Object)
|
||||
*/
|
||||
public MutablePropertyValues() {
|
||||
this.propertyValueList = new ArrayList<PropertyValue>();
|
||||
@@ -119,13 +118,19 @@ public class MutablePropertyValues implements PropertyValues, Serializable {
|
||||
return this.propertyValueList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the number of PropertyValue entries in the list.
|
||||
*/
|
||||
public int size() {
|
||||
return this.propertyValueList.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy all given PropertyValues into this object. Guarantees PropertyValue
|
||||
* references are independent, although it can't deep copy objects currently
|
||||
* referenced by individual PropertyValue objects.
|
||||
* @param other the PropertyValues to copy
|
||||
* @return this object to allow creating objects, adding multiple PropertyValues
|
||||
* in a single statement
|
||||
* @return this in order to allow for adding multiple property values in a chain
|
||||
*/
|
||||
public MutablePropertyValues addPropertyValues(PropertyValues other) {
|
||||
if (other != null) {
|
||||
@@ -141,8 +146,7 @@ public class MutablePropertyValues implements PropertyValues, Serializable {
|
||||
* Add all property values from the given Map.
|
||||
* @param other Map with property values keyed by property name,
|
||||
* which must be a String
|
||||
* @return this object to allow creating objects, adding multiple
|
||||
* PropertyValues in a single statement
|
||||
* @return this in order to allow for adding multiple property values in a chain
|
||||
*/
|
||||
public MutablePropertyValues addPropertyValues(Map<?, ?> other) {
|
||||
if (other != null) {
|
||||
@@ -154,11 +158,10 @@ public class MutablePropertyValues implements PropertyValues, Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a PropertyValue object, replacing any existing one
|
||||
* for the corresponding property.
|
||||
* Add a PropertyValue object, replacing any existing one for the
|
||||
* corresponding property or getting merged with it (if applicable).
|
||||
* @param pv PropertyValue object to add
|
||||
* @return this object to allow creating objects, adding multiple
|
||||
* PropertyValues in a single statement
|
||||
* @return this in order to allow for adding multiple property values in a chain
|
||||
*/
|
||||
public MutablePropertyValues addPropertyValue(PropertyValue pv) {
|
||||
for (int i = 0; i < this.propertyValueList.size(); i++) {
|
||||
@@ -179,11 +182,25 @@ public class MutablePropertyValues implements PropertyValues, Serializable {
|
||||
* @param propertyName name of the property
|
||||
* @param propertyValue value of the property
|
||||
* @see #addPropertyValue(PropertyValue)
|
||||
* @deprecated as of Spring 3.0, in favor of the chaining-capable {@link #add}
|
||||
*/
|
||||
@Deprecated
|
||||
public void addPropertyValue(String propertyName, Object propertyValue) {
|
||||
addPropertyValue(new PropertyValue(propertyName, propertyValue));
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a PropertyValue object, replacing any existing one for the
|
||||
* corresponding property or getting merged with it (if applicable).
|
||||
* @param propertyName name of the property
|
||||
* @param propertyValue value of the property
|
||||
* @return this in order to allow for adding multiple property values in a chain
|
||||
*/
|
||||
public MutablePropertyValues add(String propertyName, Object propertyValue) {
|
||||
addPropertyValue(new PropertyValue(propertyName, propertyValue));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Modify a PropertyValue object held in this object.
|
||||
* Indexed from 0.
|
||||
@@ -209,15 +226,6 @@ public class MutablePropertyValues implements PropertyValues, Serializable {
|
||||
return newPv;
|
||||
}
|
||||
|
||||
/**
|
||||
* Overloaded version of <code>removePropertyValue</code> that takes a property name.
|
||||
* @param propertyName name of the property
|
||||
* @see #removePropertyValue(PropertyValue)
|
||||
*/
|
||||
public void removePropertyValue(String propertyName) {
|
||||
removePropertyValue(getPropertyValue(propertyName));
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the given PropertyValue, if contained.
|
||||
* @param pv the PropertyValue to remove
|
||||
@@ -227,10 +235,12 @@ public class MutablePropertyValues implements PropertyValues, Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear this holder, removing all PropertyValues.
|
||||
* Overloaded version of <code>removePropertyValue</code> that takes a property name.
|
||||
* @param propertyName name of the property
|
||||
* @see #removePropertyValue(PropertyValue)
|
||||
*/
|
||||
public void clear() {
|
||||
this.propertyValueList.clear();
|
||||
public void removePropertyValue(String propertyName) {
|
||||
this.propertyValueList.remove(getPropertyValue(propertyName));
|
||||
}
|
||||
|
||||
|
||||
@@ -247,34 +257,6 @@ public class MutablePropertyValues implements PropertyValues, Serializable {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the specified property as "processed" in the sense
|
||||
* of some processor calling the corresponding setter method
|
||||
* outside of the PropertyValue(s) mechanism.
|
||||
* <p>This will lead to <code>true</code> being returned from
|
||||
* a {@link #contains} call for the specified property.
|
||||
* @param propertyName the name of the property.
|
||||
*/
|
||||
public void registerProcessedProperty(String propertyName) {
|
||||
if (this.processedProperties == null) {
|
||||
this.processedProperties = new HashSet<String>();
|
||||
}
|
||||
this.processedProperties.add(propertyName);
|
||||
}
|
||||
|
||||
public boolean contains(String propertyName) {
|
||||
return (getPropertyValue(propertyName) != null ||
|
||||
(this.processedProperties != null && this.processedProperties.contains(propertyName)));
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return this.propertyValueList.isEmpty();
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return this.propertyValueList.size();
|
||||
}
|
||||
|
||||
public PropertyValues changesSince(PropertyValues old) {
|
||||
MutablePropertyValues changes = new MutablePropertyValues();
|
||||
if (old == this) {
|
||||
@@ -296,6 +278,30 @@ public class MutablePropertyValues implements PropertyValues, Serializable {
|
||||
return changes;
|
||||
}
|
||||
|
||||
public boolean contains(String propertyName) {
|
||||
return (getPropertyValue(propertyName) != null ||
|
||||
(this.processedProperties != null && this.processedProperties.contains(propertyName)));
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return this.propertyValueList.isEmpty();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Register the specified property as "processed" in the sense
|
||||
* of some processor calling the corresponding setter method
|
||||
* outside of the PropertyValue(s) mechanism.
|
||||
* <p>This will lead to <code>true</code> being returned from
|
||||
* a {@link #contains} call for the specified property.
|
||||
* @param propertyName the name of the property.
|
||||
*/
|
||||
public void registerProcessedProperty(String propertyName) {
|
||||
if (this.processedProperties == null) {
|
||||
this.processedProperties = new HashSet<String>();
|
||||
}
|
||||
this.processedProperties.add(propertyName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark this holder as containing converted values only
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -39,6 +39,16 @@ public interface PropertyValues {
|
||||
*/
|
||||
PropertyValue getPropertyValue(String propertyName);
|
||||
|
||||
/**
|
||||
* Return the changes since the previous PropertyValues.
|
||||
* Subclasses should also override <code>equals</code>.
|
||||
* @param old old property values
|
||||
* @return PropertyValues updated or new properties.
|
||||
* Return empty PropertyValues if there are no changes.
|
||||
* @see java.lang.Object#equals
|
||||
*/
|
||||
PropertyValues changesSince(PropertyValues old);
|
||||
|
||||
/**
|
||||
* Is there a property value (or other processing entry) for this property?
|
||||
* @param propertyName the name of the property we're interested in
|
||||
@@ -51,14 +61,4 @@ public interface PropertyValues {
|
||||
*/
|
||||
boolean isEmpty();
|
||||
|
||||
/**
|
||||
* Return the changes since the previous PropertyValues.
|
||||
* Subclasses should also override <code>equals</code>.
|
||||
* @param old old property values
|
||||
* @return PropertyValues updated or new properties.
|
||||
* Return empty PropertyValues if there are no changes.
|
||||
* @see java.lang.Object#equals
|
||||
*/
|
||||
PropertyValues changesSince(PropertyValues old);
|
||||
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ public class BeanDefinitionVisitor {
|
||||
for (PropertyValue pv : pvArray) {
|
||||
Object newVal = resolveValue(pv.getValue());
|
||||
if (!ObjectUtils.nullSafeEquals(newVal, pv.getValue())) {
|
||||
pvs.addPropertyValue(pv.getName(), newVal);
|
||||
pvs.add(pv.getName(), newVal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,12 +99,14 @@ public interface ConfigurableBeanFactory extends HierarchicalBeanFactory, Single
|
||||
* <i>load-time weaving</i> is involved, to make sure that actual bean
|
||||
* classes are loaded as lazily as possible. The temporary loader is
|
||||
* then removed once the BeanFactory completes its bootstrap phase.
|
||||
* @since 2.5
|
||||
*/
|
||||
void setTempClassLoader(ClassLoader tempClassLoader);
|
||||
|
||||
/**
|
||||
* Return the temporary ClassLoader to use for type matching purposes,
|
||||
* if any.
|
||||
* @since 2.5
|
||||
*/
|
||||
ClassLoader getTempClassLoader();
|
||||
|
||||
@@ -128,22 +130,26 @@ public interface ConfigurableBeanFactory extends HierarchicalBeanFactory, Single
|
||||
* <p>There is no expression support active in a BeanFactory by default.
|
||||
* An ApplicationContext will typically set a standard expression strategy
|
||||
* here, supporting "#{...}" expressions in a Unified EL compatible style.
|
||||
* @since 3.0
|
||||
*/
|
||||
void setBeanExpressionResolver(BeanExpressionResolver resolver);
|
||||
|
||||
/**
|
||||
* Return the resolution strategy for expressions in bean definition values.
|
||||
* @since 3.0
|
||||
*/
|
||||
BeanExpressionResolver getBeanExpressionResolver();
|
||||
|
||||
/**
|
||||
* Specify a Spring 3.0 ConversionService to use for converting
|
||||
* property values, as an alternative to JavaBeans PropertyEditors.
|
||||
* @since 3.0
|
||||
*/
|
||||
void setConversionService(ConversionService conversionService);
|
||||
|
||||
/**
|
||||
* Return the associated ConversionService, if any.
|
||||
* @since 3.0
|
||||
*/
|
||||
ConversionService getConversionService();
|
||||
|
||||
@@ -183,6 +189,7 @@ public interface ConfigurableBeanFactory extends HierarchicalBeanFactory, Single
|
||||
* any custom editors or custom editor registrars irrelevant.
|
||||
* @see #addPropertyEditorRegistrar
|
||||
* @see #registerCustomEditor
|
||||
* @since 2.5
|
||||
*/
|
||||
void setTypeConverter(TypeConverter typeConverter);
|
||||
|
||||
@@ -191,12 +198,14 @@ public interface ConfigurableBeanFactory extends HierarchicalBeanFactory, Single
|
||||
* instance for each call, since TypeConverters are usually <i>not</i> thread-safe.
|
||||
* <p>If the default PropertyEditor mechanism is active, the returned
|
||||
* TypeConverter will be aware of all custom editors that have been registered.
|
||||
* @since 2.5
|
||||
*/
|
||||
TypeConverter getTypeConverter();
|
||||
|
||||
/**
|
||||
* Add a String resolver for embedded values such as annotation attributes.
|
||||
* @param valueResolver the String resolver to apply to embedded values
|
||||
* @since 3.0
|
||||
*/
|
||||
void addEmbeddedValueResolver(StringValueResolver valueResolver);
|
||||
|
||||
@@ -204,6 +213,7 @@ public interface ConfigurableBeanFactory extends HierarchicalBeanFactory, Single
|
||||
* Resolve the given embedded value, e.g. an annotation attribute.
|
||||
* @param value the value to resolve
|
||||
* @return the resolved value (may be the original value as-is)
|
||||
* @since 3.0
|
||||
*/
|
||||
String resolveEmbeddedValue(String value);
|
||||
|
||||
@@ -253,6 +263,7 @@ public interface ConfigurableBeanFactory extends HierarchicalBeanFactory, Single
|
||||
/**
|
||||
* Provides a security access control context relevant to this factory.
|
||||
* @return the applicable AccessControlContext (never <code>null</code>)
|
||||
* @since 3.0
|
||||
*/
|
||||
AccessControlContext getAccessControlContext();
|
||||
|
||||
@@ -284,6 +295,7 @@ public interface ConfigurableBeanFactory extends HierarchicalBeanFactory, Single
|
||||
* <p>The value resolver may for example resolve placeholders
|
||||
* in target bean names and even in alias names.
|
||||
* @param valueResolver the StringValueResolver to apply
|
||||
* @since 2.5
|
||||
*/
|
||||
void resolveAliases(StringValueResolver valueResolver);
|
||||
|
||||
@@ -294,6 +306,7 @@ public interface ConfigurableBeanFactory extends HierarchicalBeanFactory, Single
|
||||
* @param beanName the name of the bean to retrieve the merged definition for
|
||||
* @return a (potentially merged) BeanDefinition for the given bean
|
||||
* @throws NoSuchBeanDefinitionException if there is no bean definition with the given name
|
||||
* @since 2.5
|
||||
*/
|
||||
BeanDefinition getMergedBeanDefinition(String beanName) throws NoSuchBeanDefinitionException;
|
||||
|
||||
@@ -303,6 +316,7 @@ public interface ConfigurableBeanFactory extends HierarchicalBeanFactory, Single
|
||||
* @return whether the bean is a FactoryBean
|
||||
* (<code>false</code> means the bean exists but is not a FactoryBean)
|
||||
* @throws NoSuchBeanDefinitionException if there is no bean with the given name
|
||||
* @since 2.5
|
||||
*/
|
||||
boolean isFactoryBean(String name) throws NoSuchBeanDefinitionException;
|
||||
|
||||
@@ -310,6 +324,7 @@ public interface ConfigurableBeanFactory extends HierarchicalBeanFactory, Single
|
||||
* Determine whether the specified bean is currently in creation.
|
||||
* @param beanName the name of the bean
|
||||
* @return whether the bean is currently in creation
|
||||
* @since 2.5
|
||||
*/
|
||||
boolean isCurrentlyInCreation(String beanName);
|
||||
|
||||
@@ -318,6 +333,7 @@ public interface ConfigurableBeanFactory extends HierarchicalBeanFactory, Single
|
||||
* to be destroyed before the given bean is destroyed.
|
||||
* @param beanName the name of the bean
|
||||
* @param dependentBeanName the name of the dependent bean
|
||||
* @since 2.5
|
||||
*/
|
||||
void registerDependentBean(String beanName, String dependentBeanName);
|
||||
|
||||
@@ -325,6 +341,7 @@ public interface ConfigurableBeanFactory extends HierarchicalBeanFactory, Single
|
||||
* Return the names of all beans which depend on the specified bean, if any.
|
||||
* @param beanName the name of the bean
|
||||
* @return the array of dependent bean names, or an empty array if none
|
||||
* @since 2.5
|
||||
*/
|
||||
String[] getDependentBeans(String beanName);
|
||||
|
||||
@@ -333,6 +350,7 @@ public interface ConfigurableBeanFactory extends HierarchicalBeanFactory, Single
|
||||
* @param beanName the name of the bean
|
||||
* @return the array of names of beans which the bean depends on,
|
||||
* or an empty array if none
|
||||
* @since 2.5
|
||||
*/
|
||||
String[] getDependenciesForBean(String beanName);
|
||||
|
||||
|
||||
@@ -1083,7 +1083,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||
for (String propertyName : propertyNames) {
|
||||
if (containsBean(propertyName)) {
|
||||
Object bean = getBean(propertyName);
|
||||
pvs.addPropertyValue(propertyName, bean);
|
||||
pvs.add(propertyName, bean);
|
||||
registerDependentBean(propertyName, beanName);
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug(
|
||||
@@ -1131,7 +1131,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||
|
||||
Object autowiredArgument = resolveDependency(desc, beanName, autowiredBeanNames, converter);
|
||||
if (autowiredArgument != null) {
|
||||
pvs.addPropertyValue(propertyName, autowiredArgument);
|
||||
pvs.add(propertyName, autowiredArgument);
|
||||
}
|
||||
for (String autowiredBeanName : autowiredBeanNames) {
|
||||
registerDependentBean(autowiredBeanName, beanName);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package org.springframework.beans.factory.support;
|
||||
|
||||
import org.springframework.beans.PropertyValue;
|
||||
import org.springframework.beans.factory.config.RuntimeBeanReference;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
@@ -194,7 +193,8 @@ public class BeanDefinitionBuilder {
|
||||
* and all additions are at the present point.
|
||||
*/
|
||||
public BeanDefinitionBuilder addConstructorArgValue(Object value) {
|
||||
this.beanDefinition.getConstructorArgumentValues().addIndexedArgumentValue(this.constructorArgIndex++, value);
|
||||
this.beanDefinition.getConstructorArgumentValues().addIndexedArgumentValue(
|
||||
this.constructorArgIndex++, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -203,14 +203,16 @@ public class BeanDefinitionBuilder {
|
||||
* @see #addConstructorArgValue(Object)
|
||||
*/
|
||||
public BeanDefinitionBuilder addConstructorArgReference(String beanName) {
|
||||
return addConstructorArgValue(new RuntimeBeanReference(beanName));
|
||||
this.beanDefinition.getConstructorArgumentValues().addIndexedArgumentValue(
|
||||
this.constructorArgIndex++, new RuntimeBeanReference(beanName));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the supplied property value under the given name.
|
||||
*/
|
||||
public BeanDefinitionBuilder addPropertyValue(String name, Object value) {
|
||||
this.beanDefinition.getPropertyValues().addPropertyValue(new PropertyValue(name, value));
|
||||
this.beanDefinition.getPropertyValues().add(name, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -220,7 +222,8 @@ public class BeanDefinitionBuilder {
|
||||
* @param beanName the name of the bean being referenced
|
||||
*/
|
||||
public BeanDefinitionBuilder addPropertyReference(String name, String beanName) {
|
||||
return addPropertyValue(name, new RuntimeBeanReference(beanName));
|
||||
this.beanDefinition.getPropertyValues().add(name, new RuntimeBeanReference(beanName));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -459,11 +459,11 @@ public class PropertiesBeanDefinitionReader extends AbstractBeanDefinitionReader
|
||||
// It doesn't matter if the referenced bean hasn't yet been registered:
|
||||
// this will ensure that the reference is resolved at runtime.
|
||||
Object val = new RuntimeBeanReference(ref);
|
||||
pvs.addPropertyValue(property, val);
|
||||
pvs.add(property, val);
|
||||
}
|
||||
else {
|
||||
// It's a normal bean property.
|
||||
pvs.addPropertyValue(property, readValue(entry));
|
||||
pvs.add(property, readValue(entry));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2007 the original author or authors.
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -44,7 +44,7 @@ public final class ParserContext {
|
||||
|
||||
private BeanDefinition containingBeanDefinition;
|
||||
|
||||
private final Stack containingComponents = new Stack();
|
||||
private final Stack<ComponentDefinition> containingComponents = new Stack<ComponentDefinition>();
|
||||
|
||||
|
||||
public ParserContext(XmlReaderContext readerContext, BeanDefinitionParserDelegate delegate) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2007 the original author or authors.
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -44,6 +44,7 @@ import org.springframework.core.Conventions;
|
||||
* be injected into that property.
|
||||
*
|
||||
* @author Rob Harrop
|
||||
* @author Juergen Hoeller
|
||||
* @since 2.0
|
||||
*/
|
||||
public class SimplePropertyNamespaceHandler implements NamespaceHandler {
|
||||
@@ -72,11 +73,10 @@ public class SimplePropertyNamespaceHandler implements NamespaceHandler {
|
||||
}
|
||||
if (propertyName.endsWith(REF_SUFFIX)) {
|
||||
propertyName = propertyName.substring(0, propertyName.length() - REF_SUFFIX.length());
|
||||
pvs.addPropertyValue(
|
||||
Conventions.attributeNameToPropertyName(propertyName), new RuntimeBeanReference(propertyValue));
|
||||
pvs.add(Conventions.attributeNameToPropertyName(propertyName), new RuntimeBeanReference(propertyValue));
|
||||
}
|
||||
else {
|
||||
pvs.addPropertyValue(Conventions.attributeNameToPropertyName(propertyName), propertyValue);
|
||||
pvs.add(Conventions.attributeNameToPropertyName(propertyName), propertyValue);
|
||||
}
|
||||
}
|
||||
return definition;
|
||||
|
||||
@@ -36,7 +36,6 @@ import java.util.SortedMap;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeMap;
|
||||
import java.util.TreeSet;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.junit.Test;
|
||||
@@ -252,7 +251,7 @@ public final class BeanWrapperTests {
|
||||
@Test
|
||||
public void testIgnoringIndexedProperty() {
|
||||
MutablePropertyValues values = new MutablePropertyValues();
|
||||
values.addPropertyValue("toBeIgnored[0]", new Integer(42));
|
||||
values.add("toBeIgnored[0]", new Integer(42));
|
||||
BeanWrapper bw = new BeanWrapperImpl(new Object());
|
||||
bw.setPropertyValues(values, true);
|
||||
}
|
||||
@@ -260,7 +259,7 @@ public final class BeanWrapperTests {
|
||||
@Test
|
||||
public void testConvertPrimitiveToString() {
|
||||
MutablePropertyValues values = new MutablePropertyValues();
|
||||
values.addPropertyValue("name", new Integer(42));
|
||||
values.add("name", new Integer(42));
|
||||
TestBean tb = new TestBean();
|
||||
BeanWrapper bw = new BeanWrapperImpl(tb);
|
||||
bw.setPropertyValues(values);
|
||||
@@ -270,7 +269,7 @@ public final class BeanWrapperTests {
|
||||
@Test
|
||||
public void testConvertClassToString() {
|
||||
MutablePropertyValues values = new MutablePropertyValues();
|
||||
values.addPropertyValue("name", Integer.class);
|
||||
values.add("name", Integer.class);
|
||||
TestBean tb = new TestBean();
|
||||
BeanWrapper bw = new BeanWrapperImpl(tb);
|
||||
bw.registerCustomEditor(String.class, new PropertyEditorSupport() {
|
||||
@@ -874,16 +873,16 @@ public final class BeanWrapperTests {
|
||||
assertEquals("nameY", bw.getPropertyValue("map[key4][1].name"));
|
||||
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("array[0].name", "name5");
|
||||
pvs.addPropertyValue("array[1].name", "name4");
|
||||
pvs.addPropertyValue("list[0].name", "name3");
|
||||
pvs.addPropertyValue("list[1].name", "name2");
|
||||
pvs.addPropertyValue("set[0].name", "name8");
|
||||
pvs.addPropertyValue("set[1].name", "name9");
|
||||
pvs.addPropertyValue("map[key1].name", "name1");
|
||||
pvs.addPropertyValue("map['key.3'].name", "name0");
|
||||
pvs.addPropertyValue("map[key4][0].name", "nameA");
|
||||
pvs.addPropertyValue("map[key4][1].name", "nameB");
|
||||
pvs.add("array[0].name", "name5");
|
||||
pvs.add("array[1].name", "name4");
|
||||
pvs.add("list[0].name", "name3");
|
||||
pvs.add("list[1].name", "name2");
|
||||
pvs.add("set[0].name", "name8");
|
||||
pvs.add("set[1].name", "name9");
|
||||
pvs.add("map[key1].name", "name1");
|
||||
pvs.add("map['key.3'].name", "name0");
|
||||
pvs.add("map[key4][0].name", "nameA");
|
||||
pvs.add("map[key4][1].name", "nameB");
|
||||
bw.setPropertyValues(pvs);
|
||||
assertEquals("name5", tb0.getName());
|
||||
assertEquals("name4", tb1.getName());
|
||||
@@ -927,16 +926,16 @@ public final class BeanWrapperTests {
|
||||
assertEquals(tb5, bw.getPropertyValue("map[\"key2\"]"));
|
||||
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("array[0]", tb5);
|
||||
pvs.addPropertyValue("array[1]", tb4);
|
||||
pvs.addPropertyValue("list[0]", tb3);
|
||||
pvs.addPropertyValue("list[1]", tb2);
|
||||
pvs.addPropertyValue("list[2]", tb0);
|
||||
pvs.addPropertyValue("list[4]", tb1);
|
||||
pvs.addPropertyValue("map[key1]", tb1);
|
||||
pvs.addPropertyValue("map['key2']", tb0);
|
||||
pvs.addPropertyValue("map[key5]", tb4);
|
||||
pvs.addPropertyValue("map['key9']", tb5);
|
||||
pvs.add("array[0]", tb5);
|
||||
pvs.add("array[1]", tb4);
|
||||
pvs.add("list[0]", tb3);
|
||||
pvs.add("list[1]", tb2);
|
||||
pvs.add("list[2]", tb0);
|
||||
pvs.add("list[4]", tb1);
|
||||
pvs.add("map[key1]", tb1);
|
||||
pvs.add("map['key2']", tb0);
|
||||
pvs.add("map[key5]", tb4);
|
||||
pvs.add("map['key9']", tb5);
|
||||
bw.setPropertyValues(pvs);
|
||||
assertEquals(tb5, bean.getArray()[0]);
|
||||
assertEquals(tb4, bean.getArray()[1]);
|
||||
@@ -976,15 +975,15 @@ public final class BeanWrapperTests {
|
||||
});
|
||||
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("map[key1]", "rod");
|
||||
pvs.addPropertyValue("map[key2]", "rob");
|
||||
pvs.add("map[key1]", "rod");
|
||||
pvs.add("map[key2]", "rob");
|
||||
bw.setPropertyValues(pvs);
|
||||
assertEquals("rod", ((TestBean) bean.getMap().get("key1")).getName());
|
||||
assertEquals("rob", ((TestBean) bean.getMap().get("key2")).getName());
|
||||
|
||||
pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("map[key1]", "rod");
|
||||
pvs.addPropertyValue("map[key2]", "");
|
||||
pvs.add("map[key1]", "rod");
|
||||
pvs.add("map[key2]", "");
|
||||
try {
|
||||
bw.setPropertyValues(pvs);
|
||||
fail("Should have thrown TypeMismatchException");
|
||||
@@ -1012,7 +1011,7 @@ public final class BeanWrapperTests {
|
||||
inputMap.put(new Integer(1), "rod");
|
||||
inputMap.put(new Integer(2), "rob");
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("map", Collections.unmodifiableMap(inputMap));
|
||||
pvs.add("map", Collections.unmodifiableMap(inputMap));
|
||||
bw.setPropertyValues(pvs);
|
||||
assertEquals("rod", ((TestBean) bean.getMap().get(new Integer(1))).getName());
|
||||
assertEquals("rob", ((TestBean) bean.getMap().get(new Integer(2))).getName());
|
||||
@@ -1035,7 +1034,7 @@ public final class BeanWrapperTests {
|
||||
inputMap.put(new Integer(1), "rod");
|
||||
inputMap.put(new Integer(2), "rob");
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("map", new ReadOnlyMap(inputMap));
|
||||
pvs.add("map", new ReadOnlyMap(inputMap));
|
||||
bw.setPropertyValues(pvs);
|
||||
assertEquals("rod", ((TestBean) bean.getMap().get(new Integer(1))).getName());
|
||||
assertEquals("rob", ((TestBean) bean.getMap().get(new Integer(2))).getName());
|
||||
@@ -1051,7 +1050,7 @@ public final class BeanWrapperTests {
|
||||
inputMap.put(new Integer(2), "rob");
|
||||
ReadOnlyMap readOnlyMap = new ReadOnlyMap(inputMap);
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("map", readOnlyMap);
|
||||
pvs.add("map", readOnlyMap);
|
||||
bw.setPropertyValues(pvs);
|
||||
assertSame(readOnlyMap, bean.getMap());
|
||||
assertFalse(readOnlyMap.isAccessed());
|
||||
|
||||
@@ -550,7 +550,7 @@ public final class DefaultListableBeanFactoryTests {
|
||||
public void testSelfReference() {
|
||||
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("spouse", new RuntimeBeanReference("self"));
|
||||
pvs.add("spouse", new RuntimeBeanReference("self"));
|
||||
lbf.registerBeanDefinition("self", new RootBeanDefinition(TestBean.class, pvs));
|
||||
TestBean self = (TestBean) lbf.getBean("self");
|
||||
assertEquals(self, self.getSpouse());
|
||||
@@ -561,7 +561,7 @@ public final class DefaultListableBeanFactoryTests {
|
||||
try {
|
||||
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("ag", "foobar");
|
||||
pvs.add("ag", "foobar");
|
||||
lbf.registerBeanDefinition("tb", new RootBeanDefinition(TestBean.class, pvs));
|
||||
lbf.getBean("tb");
|
||||
fail("Should throw exception on invalid property");
|
||||
@@ -685,8 +685,8 @@ public final class DefaultListableBeanFactoryTests {
|
||||
|
||||
RootBeanDefinition parentDefinition = new RootBeanDefinition(TestBean.class);
|
||||
parentDefinition.setAbstract(true);
|
||||
parentDefinition.getPropertyValues().addPropertyValue("name", EXPECTED_NAME);
|
||||
parentDefinition.getPropertyValues().addPropertyValue("age", new Integer(EXPECTED_AGE));
|
||||
parentDefinition.getPropertyValues().add("name", EXPECTED_NAME);
|
||||
parentDefinition.getPropertyValues().add("age", new Integer(EXPECTED_AGE));
|
||||
|
||||
ChildBeanDefinition childDefinition = new ChildBeanDefinition("alias");
|
||||
|
||||
@@ -832,7 +832,7 @@ public final class DefaultListableBeanFactoryTests {
|
||||
}
|
||||
});
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("myFloat", "1,1");
|
||||
pvs.add("myFloat", "1,1");
|
||||
lbf.registerBeanDefinition("testBean", new RootBeanDefinition(TestBean.class, pvs));
|
||||
TestBean testBean = (TestBean) lbf.getBean("testBean");
|
||||
assertTrue(testBean.getMyFloat().floatValue() == 1.1f);
|
||||
@@ -855,7 +855,7 @@ public final class DefaultListableBeanFactoryTests {
|
||||
});
|
||||
lbf.setConversionService(conversionService);
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("myFloat", "1,1");
|
||||
pvs.add("myFloat", "1,1");
|
||||
lbf.registerBeanDefinition("testBean", new RootBeanDefinition(TestBean.class, pvs));
|
||||
TestBean testBean = (TestBean) lbf.getBean("testBean");
|
||||
assertTrue(testBean.getMyFloat().floatValue() == 1.1f);
|
||||
@@ -871,7 +871,7 @@ public final class DefaultListableBeanFactoryTests {
|
||||
}
|
||||
});
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("myFloat", new RuntimeBeanReference("myFloat"));
|
||||
pvs.add("myFloat", new RuntimeBeanReference("myFloat"));
|
||||
lbf.registerBeanDefinition("testBean", new RootBeanDefinition(TestBean.class, pvs));
|
||||
lbf.registerSingleton("myFloat", "1,1");
|
||||
TestBean testBean = (TestBean) lbf.getBean("testBean");
|
||||
@@ -884,7 +884,7 @@ public final class DefaultListableBeanFactoryTests {
|
||||
NumberFormat nf = NumberFormat.getInstance(Locale.GERMAN);
|
||||
lbf.setTypeConverter(new CustomTypeConverter(nf));
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("myFloat", "1,1");
|
||||
pvs.add("myFloat", "1,1");
|
||||
ConstructorArgumentValues cav = new ConstructorArgumentValues();
|
||||
cav.addIndexedArgumentValue(0, "myName");
|
||||
cav.addIndexedArgumentValue(1, "myAge");
|
||||
@@ -901,7 +901,7 @@ public final class DefaultListableBeanFactoryTests {
|
||||
NumberFormat nf = NumberFormat.getInstance(Locale.GERMAN);
|
||||
lbf.setTypeConverter(new CustomTypeConverter(nf));
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("myFloat", new RuntimeBeanReference("myFloat"));
|
||||
pvs.add("myFloat", new RuntimeBeanReference("myFloat"));
|
||||
ConstructorArgumentValues cav = new ConstructorArgumentValues();
|
||||
cav.addIndexedArgumentValue(0, "myName");
|
||||
cav.addIndexedArgumentValue(1, "myAge");
|
||||
@@ -973,8 +973,8 @@ public final class DefaultListableBeanFactoryTests {
|
||||
public void testRegisterExistingSingletonWithAutowire() {
|
||||
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("name", "Tony");
|
||||
pvs.addPropertyValue("age", "48");
|
||||
pvs.add("name", "Tony");
|
||||
pvs.add("age", "48");
|
||||
RootBeanDefinition bd = new RootBeanDefinition(DependenciesBean.class, pvs);
|
||||
bd.setDependencyCheck(RootBeanDefinition.DEPENDENCY_CHECK_OBJECTS);
|
||||
bd.setAutowireMode(RootBeanDefinition.AUTOWIRE_BY_TYPE);
|
||||
@@ -1115,7 +1115,7 @@ public final class DefaultListableBeanFactoryTests {
|
||||
public void testAutowireWithSatisfiedJavaBeanDependency() {
|
||||
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("name", "Rod");
|
||||
pvs.add("name", "Rod");
|
||||
RootBeanDefinition bd = new RootBeanDefinition(TestBean.class, pvs);
|
||||
lbf.registerBeanDefinition("rod", bd);
|
||||
assertEquals(1, lbf.getBeanDefinitionCount());
|
||||
@@ -1131,7 +1131,7 @@ public final class DefaultListableBeanFactoryTests {
|
||||
public void testAutowireWithSatisfiedConstructorDependency() {
|
||||
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("name", "Rod");
|
||||
pvs.add("name", "Rod");
|
||||
RootBeanDefinition bd = new RootBeanDefinition(TestBean.class, pvs);
|
||||
lbf.registerBeanDefinition("rod", bd);
|
||||
assertEquals(1, lbf.getBeanDefinitionCount());
|
||||
@@ -1392,7 +1392,7 @@ public final class DefaultListableBeanFactoryTests {
|
||||
public void testApplyBeanPropertyValues() {
|
||||
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("age", "99");
|
||||
pvs.add("age", "99");
|
||||
lbf.registerBeanDefinition("test", new RootBeanDefinition(TestBean.class, pvs));
|
||||
TestBean tb = new TestBean();
|
||||
assertEquals(0, tb.getAge());
|
||||
@@ -1404,7 +1404,7 @@ public final class DefaultListableBeanFactoryTests {
|
||||
public void testApplyBeanPropertyValuesWithIncompleteDefinition() {
|
||||
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("age", "99");
|
||||
pvs.add("age", "99");
|
||||
lbf.registerBeanDefinition("test", new RootBeanDefinition(null, pvs));
|
||||
TestBean tb = new TestBean();
|
||||
assertEquals(0, tb.getAge());
|
||||
@@ -1418,7 +1418,7 @@ public final class DefaultListableBeanFactoryTests {
|
||||
public void testConfigureBean() {
|
||||
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("age", "99");
|
||||
pvs.add("age", "99");
|
||||
lbf.registerBeanDefinition("test", new RootBeanDefinition(TestBean.class, pvs));
|
||||
TestBean tb = new TestBean();
|
||||
assertEquals(0, tb.getAge());
|
||||
@@ -1434,7 +1434,7 @@ public final class DefaultListableBeanFactoryTests {
|
||||
RootBeanDefinition bd = new RootBeanDefinition(TestBean.class, new MutablePropertyValues());
|
||||
lbf.registerBeanDefinition("spouse", bd);
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("age", "99");
|
||||
pvs.add("age", "99");
|
||||
lbf.registerBeanDefinition("test", new RootBeanDefinition(TestBean.class, RootBeanDefinition.AUTOWIRE_BY_NAME));
|
||||
TestBean tb = new TestBean();
|
||||
lbf.configureBean(tb, "test");
|
||||
@@ -1753,8 +1753,8 @@ public final class DefaultListableBeanFactoryTests {
|
||||
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
|
||||
RootBeanDefinition rbd = new RootBeanDefinition(TestBean.class);
|
||||
rbd.setScope(RootBeanDefinition.SCOPE_PROTOTYPE);
|
||||
rbd.getPropertyValues().addPropertyValue("name", "juergen");
|
||||
rbd.getPropertyValues().addPropertyValue("age", "99");
|
||||
rbd.getPropertyValues().add("name", "juergen");
|
||||
rbd.getPropertyValues().add("age", "99");
|
||||
lbf.registerBeanDefinition("test", rbd);
|
||||
StopWatch sw = new StopWatch();
|
||||
sw.start("prototype");
|
||||
@@ -1802,7 +1802,7 @@ public final class DefaultListableBeanFactoryTests {
|
||||
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
|
||||
RootBeanDefinition rbd = new RootBeanDefinition(TestBean.class);
|
||||
rbd.setScope(RootBeanDefinition.SCOPE_PROTOTYPE);
|
||||
rbd.getPropertyValues().addPropertyValue("spouse", new RuntimeBeanReference("spouse"));
|
||||
rbd.getPropertyValues().add("spouse", new RuntimeBeanReference("spouse"));
|
||||
lbf.registerBeanDefinition("test", rbd);
|
||||
lbf.registerBeanDefinition("spouse", new RootBeanDefinition(TestBean.class));
|
||||
TestBean spouse = (TestBean) lbf.getBean("spouse");
|
||||
@@ -1882,7 +1882,7 @@ public final class DefaultListableBeanFactoryTests {
|
||||
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
|
||||
RootBeanDefinition instanceFactoryDefinition = new RootBeanDefinition(BeanWithFactoryMethod.class);
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("name", expectedNameFromProperties);
|
||||
pvs.add("name", expectedNameFromProperties);
|
||||
instanceFactoryDefinition.setPropertyValues(pvs);
|
||||
lbf.registerBeanDefinition("factoryBeanInstance", instanceFactoryDefinition);
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ public final class AutowiredAnnotationBeanPostProcessorTests {
|
||||
bf.addBeanPostProcessor(bpp);
|
||||
RootBeanDefinition annotatedBd = new RootBeanDefinition(TypedExtendedResourceInjectionBean.class);
|
||||
TestBean tb2 = new TestBean();
|
||||
annotatedBd.getPropertyValues().addPropertyValue("testBean2", tb2);
|
||||
annotatedBd.getPropertyValues().add("testBean2", tb2);
|
||||
bf.registerBeanDefinition("annotatedBean", annotatedBd);
|
||||
TestBean tb = new TestBean();
|
||||
bf.registerSingleton("testBean", tb);
|
||||
|
||||
@@ -126,7 +126,7 @@ public class InjectAnnotationBeanPostProcessorTests {
|
||||
bf.addBeanPostProcessor(bpp);
|
||||
RootBeanDefinition annotatedBd = new RootBeanDefinition(TypedExtendedResourceInjectionBean.class);
|
||||
TestBean tb2 = new TestBean();
|
||||
annotatedBd.getPropertyValues().addPropertyValue("testBean2", tb2);
|
||||
annotatedBd.getPropertyValues().add("testBean2", tb2);
|
||||
bf.registerBeanDefinition("annotatedBean", annotatedBd);
|
||||
TestBean tb = new TestBean();
|
||||
bf.registerSingleton("testBean", tb);
|
||||
|
||||
@@ -60,10 +60,10 @@ public final class CustomEditorConfigurerTests {
|
||||
cec.postProcessBeanFactory(bf);
|
||||
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("date", "2.12.1975");
|
||||
pvs.add("date", "2.12.1975");
|
||||
bf.registerBeanDefinition("tb1", new RootBeanDefinition(TestBean.class, pvs));
|
||||
pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("someMap[myKey]", new TypedStringValue("2.12.1975", Date.class));
|
||||
pvs.add("someMap[myKey]", new TypedStringValue("2.12.1975", Date.class));
|
||||
bf.registerBeanDefinition("tb2", new RootBeanDefinition(TestBean.class, pvs));
|
||||
|
||||
TestBean tb1 = (TestBean) bf.getBean("tb1");
|
||||
@@ -83,10 +83,10 @@ public final class CustomEditorConfigurerTests {
|
||||
cec.postProcessBeanFactory(bf);
|
||||
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("date", "2.12.1975");
|
||||
pvs.add("date", "2.12.1975");
|
||||
bf.registerBeanDefinition("tb1", new RootBeanDefinition(TestBean.class, pvs));
|
||||
pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("someMap[myKey]", new TypedStringValue("2.12.1975", Date.class));
|
||||
pvs.add("someMap[myKey]", new TypedStringValue("2.12.1975", Date.class));
|
||||
bf.registerBeanDefinition("tb2", new RootBeanDefinition(TestBean.class, pvs));
|
||||
|
||||
TestBean tb1 = (TestBean) bf.getBean("tb1");
|
||||
@@ -105,7 +105,7 @@ public final class CustomEditorConfigurerTests {
|
||||
cec.postProcessBeanFactory(bf);
|
||||
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("date", "2.12.1975");
|
||||
pvs.add("date", "2.12.1975");
|
||||
bf.registerBeanDefinition("tb", new RootBeanDefinition(TestBean.class, pvs));
|
||||
|
||||
TestBean tb = (TestBean) bf.getBean("tb");
|
||||
@@ -123,7 +123,7 @@ public final class CustomEditorConfigurerTests {
|
||||
cec.postProcessBeanFactory(bf);
|
||||
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("date", "2.12.1975");
|
||||
pvs.add("date", "2.12.1975");
|
||||
bf.registerBeanDefinition("tb", new RootBeanDefinition(TestBean.class, pvs));
|
||||
|
||||
TestBean tb = (TestBean) bf.getBean("tb");
|
||||
@@ -141,7 +141,7 @@ public final class CustomEditorConfigurerTests {
|
||||
cec.postProcessBeanFactory(bf);
|
||||
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("stringArray", "xxx");
|
||||
pvs.add("stringArray", "xxx");
|
||||
bf.registerBeanDefinition("tb", new RootBeanDefinition(TestBean.class, pvs));
|
||||
|
||||
TestBean tb = (TestBean) bf.getBean("tb");
|
||||
|
||||
@@ -351,11 +351,11 @@ public final class PropertyResourceConfigurerTests {
|
||||
Map singletonMap = Collections.singletonMap("myKey", "myValue");
|
||||
if (parentChildSeparation) {
|
||||
MutablePropertyValues pvs1 = new MutablePropertyValues();
|
||||
pvs1.addPropertyValue("age", "${age}");
|
||||
pvs1.add("age", "${age}");
|
||||
MutablePropertyValues pvs2 = new MutablePropertyValues();
|
||||
pvs2.addPropertyValue("name", "name${var}${var}${");
|
||||
pvs2.addPropertyValue("spouse", new RuntimeBeanReference("${ref}"));
|
||||
pvs2.addPropertyValue("someMap", singletonMap);
|
||||
pvs2.add("name", "name${var}${var}${");
|
||||
pvs2.add("spouse", new RuntimeBeanReference("${ref}"));
|
||||
pvs2.add("someMap", singletonMap);
|
||||
RootBeanDefinition parent = new RootBeanDefinition(TestBean.class, pvs1);
|
||||
ChildBeanDefinition bd = new ChildBeanDefinition("${parent}", pvs2);
|
||||
factory.registerBeanDefinition("parent1", parent);
|
||||
@@ -363,10 +363,10 @@ public final class PropertyResourceConfigurerTests {
|
||||
}
|
||||
else {
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("age", "${age}");
|
||||
pvs.addPropertyValue("name", "name${var}${var}${");
|
||||
pvs.addPropertyValue("spouse", new RuntimeBeanReference("${ref}"));
|
||||
pvs.addPropertyValue("someMap", singletonMap);
|
||||
pvs.add("age", "${age}");
|
||||
pvs.add("name", "name${var}${var}${");
|
||||
pvs.add("spouse", new RuntimeBeanReference("${ref}"));
|
||||
pvs.add("someMap", singletonMap);
|
||||
RootBeanDefinition bd = new RootBeanDefinition(TestBean.class, pvs);
|
||||
factory.registerBeanDefinition("tb1", bd);
|
||||
}
|
||||
@@ -379,13 +379,13 @@ public final class PropertyResourceConfigurerTests {
|
||||
List<Object> friends = new ManagedList<Object>();
|
||||
friends.add("na${age}me");
|
||||
friends.add(new RuntimeBeanReference("${ref}"));
|
||||
pvs.addPropertyValue("friends", friends);
|
||||
pvs.add("friends", friends);
|
||||
|
||||
Set<Object> someSet = new ManagedSet<Object>();
|
||||
someSet.add("na${age}me");
|
||||
someSet.add(new RuntimeBeanReference("${ref}"));
|
||||
someSet.add(new TypedStringValue("${age}", Integer.class));
|
||||
pvs.addPropertyValue("someSet", someSet);
|
||||
pvs.add("someSet", someSet);
|
||||
|
||||
Map<Object, Object> someMap = new ManagedMap<Object, Object>();
|
||||
someMap.put(new TypedStringValue("key${age}"), new TypedStringValue("${age}"));
|
||||
@@ -393,11 +393,11 @@ public final class PropertyResourceConfigurerTests {
|
||||
someMap.put("key1", new RuntimeBeanReference("${ref}"));
|
||||
someMap.put("key2", "${age}name");
|
||||
MutablePropertyValues innerPvs = new MutablePropertyValues();
|
||||
innerPvs.addPropertyValue("touchy", "${os.name}");
|
||||
innerPvs.add("touchy", "${os.name}");
|
||||
someMap.put("key3", new RootBeanDefinition(TestBean.class, innerPvs));
|
||||
MutablePropertyValues innerPvs2 = new MutablePropertyValues(innerPvs);
|
||||
someMap.put("${key4}", new BeanDefinitionHolder(new ChildBeanDefinition("tb1", innerPvs2), "child"));
|
||||
pvs.addPropertyValue("someMap", someMap);
|
||||
pvs.add("someMap", someMap);
|
||||
|
||||
RootBeanDefinition bd = new RootBeanDefinition(TestBean.class, cas, pvs);
|
||||
factory.registerBeanDefinition("tb2", bd);
|
||||
|
||||
@@ -43,7 +43,7 @@ public class ServiceLoaderTests {
|
||||
|
||||
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
|
||||
RootBeanDefinition bd = new RootBeanDefinition(ServiceLoaderFactoryBean.class);
|
||||
bd.getPropertyValues().addPropertyValue("serviceType", DocumentBuilderFactory.class.getName());
|
||||
bd.getPropertyValues().add("serviceType", DocumentBuilderFactory.class.getName());
|
||||
bf.registerBeanDefinition("service", bd);
|
||||
ServiceLoader<?> serviceLoader = (ServiceLoader<?>) bf.getBean("service");
|
||||
assertTrue(serviceLoader.iterator().next() instanceof DocumentBuilderFactory);
|
||||
@@ -58,7 +58,7 @@ public class ServiceLoaderTests {
|
||||
|
||||
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
|
||||
RootBeanDefinition bd = new RootBeanDefinition(ServiceFactoryBean.class);
|
||||
bd.getPropertyValues().addPropertyValue("serviceType", DocumentBuilderFactory.class.getName());
|
||||
bd.getPropertyValues().add("serviceType", DocumentBuilderFactory.class.getName());
|
||||
bf.registerBeanDefinition("service", bd);
|
||||
assertTrue(bf.getBean("service") instanceof DocumentBuilderFactory);
|
||||
}
|
||||
@@ -72,7 +72,7 @@ public class ServiceLoaderTests {
|
||||
|
||||
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
|
||||
RootBeanDefinition bd = new RootBeanDefinition(ServiceListFactoryBean.class);
|
||||
bd.getPropertyValues().addPropertyValue("serviceType", DocumentBuilderFactory.class.getName());
|
||||
bd.getPropertyValues().add("serviceType", DocumentBuilderFactory.class.getName());
|
||||
bf.registerBeanDefinition("service", bd);
|
||||
List<?> serviceList = (List<?>) bf.getBean("service");
|
||||
assertTrue(serviceList.get(0) instanceof DocumentBuilderFactory);
|
||||
|
||||
@@ -45,16 +45,16 @@ public class BeanDefinitionTests extends TestCase {
|
||||
|
||||
public void testBeanDefinitionEqualityWithPropertyValues() {
|
||||
RootBeanDefinition bd = new RootBeanDefinition(TestBean.class);
|
||||
bd.getPropertyValues().addPropertyValue("name", "myName");
|
||||
bd.getPropertyValues().addPropertyValue("age", "99");
|
||||
bd.getPropertyValues().add("name", "myName");
|
||||
bd.getPropertyValues().add("age", "99");
|
||||
RootBeanDefinition otherBd = new RootBeanDefinition(TestBean.class);
|
||||
otherBd.getPropertyValues().addPropertyValue("name", "myName");
|
||||
otherBd.getPropertyValues().add("name", "myName");
|
||||
assertTrue(!bd.equals(otherBd));
|
||||
assertTrue(!otherBd.equals(bd));
|
||||
otherBd.getPropertyValues().addPropertyValue("age", "11");
|
||||
otherBd.getPropertyValues().add("age", "11");
|
||||
assertTrue(!bd.equals(otherBd));
|
||||
assertTrue(!otherBd.equals(bd));
|
||||
otherBd.getPropertyValues().addPropertyValue("age", "99");
|
||||
otherBd.getPropertyValues().add("age", "99");
|
||||
assertTrue(bd.equals(otherBd));
|
||||
assertTrue(otherBd.equals(bd));
|
||||
assertTrue(bd.hashCode() == otherBd.hashCode());
|
||||
@@ -117,8 +117,8 @@ public class BeanDefinitionTests extends TestCase {
|
||||
RootBeanDefinition bd = new RootBeanDefinition(TestBean.class);
|
||||
bd.getConstructorArgumentValues().addGenericArgumentValue("test");
|
||||
bd.getConstructorArgumentValues().addIndexedArgumentValue(1, new Integer(5));
|
||||
bd.getPropertyValues().addPropertyValue("name", "myName");
|
||||
bd.getPropertyValues().addPropertyValue("age", "99");
|
||||
bd.getPropertyValues().add("name", "myName");
|
||||
bd.getPropertyValues().add("age", "99");
|
||||
|
||||
ChildBeanDefinition childBd = new ChildBeanDefinition("bd");
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ public class BeanFactoryGenericsTests {
|
||||
Set<String> input = new HashSet<String>();
|
||||
input.add("4");
|
||||
input.add("5");
|
||||
rbd.getPropertyValues().addPropertyValue("integerSet", input);
|
||||
rbd.getPropertyValues().add("integerSet", input);
|
||||
|
||||
bf.registerBeanDefinition("genericBean", rbd);
|
||||
GenericBean<?> gb = (GenericBean<?>) bf.getBean("genericBean");
|
||||
@@ -75,7 +75,7 @@ public class BeanFactoryGenericsTests {
|
||||
List<String> input = new ArrayList<String>();
|
||||
input.add("http://localhost:8080");
|
||||
input.add("http://localhost:9090");
|
||||
rbd.getPropertyValues().addPropertyValue("resourceList", input);
|
||||
rbd.getPropertyValues().add("resourceList", input);
|
||||
|
||||
bf.registerBeanDefinition("genericBean", rbd);
|
||||
GenericBean<?> gb = (GenericBean<?>) bf.getBean("genericBean");
|
||||
@@ -105,7 +105,7 @@ public class BeanFactoryGenericsTests {
|
||||
|
||||
List input = new ArrayList();
|
||||
input.add(1);
|
||||
rbd.getPropertyValues().addPropertyValue("testBeanList", input);
|
||||
rbd.getPropertyValues().add("testBeanList", input);
|
||||
|
||||
bf.registerBeanDefinition("genericBean", rbd);
|
||||
try {
|
||||
@@ -137,7 +137,7 @@ public class BeanFactoryGenericsTests {
|
||||
Map<String, String> input = new HashMap<String, String>();
|
||||
input.put("4", "5");
|
||||
input.put("6", "7");
|
||||
rbd.getPropertyValues().addPropertyValue("shortMap", input);
|
||||
rbd.getPropertyValues().add("shortMap", input);
|
||||
|
||||
bf.registerBeanDefinition("genericBean", rbd);
|
||||
GenericBean<?> gb = (GenericBean<?>) bf.getBean("genericBean");
|
||||
|
||||
@@ -80,7 +80,7 @@ public class DefinitionMetadataEqualsHashCodeTests extends TestCase {
|
||||
definition.setLazyInit(true);
|
||||
definition.getMethodOverrides().addOverride(new LookupOverride("foo", "bar"));
|
||||
definition.getMethodOverrides().addOverride(new ReplaceOverride("foo", "bar"));
|
||||
definition.getPropertyValues().addPropertyValue("foo", "bar");
|
||||
definition.getPropertyValues().add("foo", "bar");
|
||||
definition.setResourceDescription("desc");
|
||||
definition.setRole(BeanDefinition.ROLE_APPLICATION);
|
||||
definition.setScope(BeanDefinition.SCOPE_PROTOTYPE);
|
||||
|
||||
@@ -57,7 +57,7 @@ public class AutowireWithExclusionTests extends TestCase {
|
||||
parent.preInstantiateSingletons();
|
||||
DefaultListableBeanFactory child = new DefaultListableBeanFactory(parent);
|
||||
RootBeanDefinition robDef = new RootBeanDefinition(TestBean.class, RootBeanDefinition.AUTOWIRE_BY_TYPE);
|
||||
robDef.getPropertyValues().addPropertyValue("spouse", new RuntimeBeanReference("sally"));
|
||||
robDef.getPropertyValues().add("spouse", new RuntimeBeanReference("sally"));
|
||||
child.registerBeanDefinition("rob2", robDef);
|
||||
TestBean rob = (TestBean) child.getBean("rob2");
|
||||
assertEquals("props1", rob.getSomeProperties().getProperty("name"));
|
||||
@@ -71,10 +71,10 @@ public class AutowireWithExclusionTests extends TestCase {
|
||||
parent.preInstantiateSingletons();
|
||||
DefaultListableBeanFactory child = new DefaultListableBeanFactory(parent);
|
||||
RootBeanDefinition robDef = new RootBeanDefinition(TestBean.class, RootBeanDefinition.AUTOWIRE_BY_TYPE);
|
||||
robDef.getPropertyValues().addPropertyValue("spouse", new RuntimeBeanReference("sally"));
|
||||
robDef.getPropertyValues().add("spouse", new RuntimeBeanReference("sally"));
|
||||
child.registerBeanDefinition("rob2", robDef);
|
||||
RootBeanDefinition propsDef = new RootBeanDefinition(PropertiesFactoryBean.class);
|
||||
propsDef.getPropertyValues().addPropertyValue("properties", "name=props3");
|
||||
propsDef.getPropertyValues().add("properties", "name=props3");
|
||||
child.registerBeanDefinition("props3", propsDef);
|
||||
TestBean rob = (TestBean) child.getBean("rob2");
|
||||
assertEquals("props1", rob.getSomeProperties().getProperty("name"));
|
||||
@@ -87,10 +87,10 @@ public class AutowireWithExclusionTests extends TestCase {
|
||||
parent.preInstantiateSingletons();
|
||||
DefaultListableBeanFactory child = new DefaultListableBeanFactory(parent);
|
||||
RootBeanDefinition robDef = new RootBeanDefinition(TestBean.class, RootBeanDefinition.AUTOWIRE_BY_TYPE);
|
||||
robDef.getPropertyValues().addPropertyValue("spouse", new RuntimeBeanReference("sally"));
|
||||
robDef.getPropertyValues().add("spouse", new RuntimeBeanReference("sally"));
|
||||
child.registerBeanDefinition("rob2", robDef);
|
||||
RootBeanDefinition propsDef = new RootBeanDefinition(PropertiesFactoryBean.class);
|
||||
propsDef.getPropertyValues().addPropertyValue("properties", "name=props3");
|
||||
propsDef.getPropertyValues().add("properties", "name=props3");
|
||||
propsDef.setPrimary(true);
|
||||
child.registerBeanDefinition("props3", propsDef);
|
||||
TestBean rob = (TestBean) child.getBean("rob2");
|
||||
@@ -105,10 +105,10 @@ public class AutowireWithExclusionTests extends TestCase {
|
||||
parent.preInstantiateSingletons();
|
||||
DefaultListableBeanFactory child = new DefaultListableBeanFactory(parent);
|
||||
RootBeanDefinition robDef = new RootBeanDefinition(TestBean.class, RootBeanDefinition.AUTOWIRE_BY_TYPE);
|
||||
robDef.getPropertyValues().addPropertyValue("spouse", new RuntimeBeanReference("sally"));
|
||||
robDef.getPropertyValues().add("spouse", new RuntimeBeanReference("sally"));
|
||||
child.registerBeanDefinition("rob2", robDef);
|
||||
RootBeanDefinition propsDef = new RootBeanDefinition(PropertiesFactoryBean.class);
|
||||
propsDef.getPropertyValues().addPropertyValue("properties", "name=props3");
|
||||
propsDef.getPropertyValues().add("properties", "name=props3");
|
||||
propsDef.setPrimary(true);
|
||||
child.registerBeanDefinition("props3", propsDef);
|
||||
TestBean rob = (TestBean) child.getBean("rob2");
|
||||
|
||||
@@ -884,12 +884,12 @@ public class CustomEditorTests {
|
||||
assertEquals("name5", bw.getPropertyValue("map[\"key2\"].name"));
|
||||
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("array[0].name", "name5");
|
||||
pvs.addPropertyValue("array[1].name", "name4");
|
||||
pvs.addPropertyValue("list[0].name", "name3");
|
||||
pvs.addPropertyValue("list[1].name", "name2");
|
||||
pvs.addPropertyValue("map[key1].name", "name1");
|
||||
pvs.addPropertyValue("map['key2'].name", "name0");
|
||||
pvs.add("array[0].name", "name5");
|
||||
pvs.add("array[1].name", "name4");
|
||||
pvs.add("list[0].name", "name3");
|
||||
pvs.add("list[1].name", "name2");
|
||||
pvs.add("map[key1].name", "name1");
|
||||
pvs.add("map['key2'].name", "name0");
|
||||
bw.setPropertyValues(pvs);
|
||||
assertEquals("prefixname5", tb0.getName());
|
||||
assertEquals("prefixname4", tb1.getName());
|
||||
@@ -948,12 +948,12 @@ public class CustomEditorTests {
|
||||
assertEquals("name5", bw.getPropertyValue("map[\"key2\"].name"));
|
||||
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("array[0].name", "name5");
|
||||
pvs.addPropertyValue("array[1].name", "name4");
|
||||
pvs.addPropertyValue("list[0].name", "name3");
|
||||
pvs.addPropertyValue("list[1].name", "name2");
|
||||
pvs.addPropertyValue("map[key1].name", "name1");
|
||||
pvs.addPropertyValue("map['key2'].name", "name0");
|
||||
pvs.add("array[0].name", "name5");
|
||||
pvs.add("array[1].name", "name4");
|
||||
pvs.add("list[0].name", "name3");
|
||||
pvs.add("list[1].name", "name2");
|
||||
pvs.add("map[key1].name", "name1");
|
||||
pvs.add("map['key2'].name", "name0");
|
||||
bw.setPropertyValues(pvs);
|
||||
assertEquals("arrayname5", tb0.getName());
|
||||
assertEquals("arrayname4", tb1.getName());
|
||||
@@ -1027,12 +1027,12 @@ public class CustomEditorTests {
|
||||
assertEquals("name5", bw.getPropertyValue("map[\"key2\"].name"));
|
||||
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("array[0].name", "name5");
|
||||
pvs.addPropertyValue("array[1].name", "name4");
|
||||
pvs.addPropertyValue("list[0].name", "name3");
|
||||
pvs.addPropertyValue("list[1].name", "name2");
|
||||
pvs.addPropertyValue("map[key1].name", "name1");
|
||||
pvs.addPropertyValue("map['key2'].name", "name0");
|
||||
pvs.add("array[0].name", "name5");
|
||||
pvs.add("array[1].name", "name4");
|
||||
pvs.add("list[0].name", "name3");
|
||||
pvs.add("list[1].name", "name2");
|
||||
pvs.add("map[key1].name", "name1");
|
||||
pvs.add("map['key2'].name", "name0");
|
||||
bw.setPropertyValues(pvs);
|
||||
assertEquals("array0name5", tb0.getName());
|
||||
assertEquals("array1name4", tb1.getName());
|
||||
@@ -1105,12 +1105,12 @@ public class CustomEditorTests {
|
||||
assertEquals("name5", bw.getPropertyValue("map['key2'].nestedIndexedBean.map[\"key2\"].name"));
|
||||
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("array[0].nestedIndexedBean.array[0].name", "name5");
|
||||
pvs.addPropertyValue("array[1].nestedIndexedBean.array[1].name", "name4");
|
||||
pvs.addPropertyValue("list[0].nestedIndexedBean.list[0].name", "name3");
|
||||
pvs.addPropertyValue("list[1].nestedIndexedBean.list[1].name", "name2");
|
||||
pvs.addPropertyValue("map[key1].nestedIndexedBean.map[\"key1\"].name", "name1");
|
||||
pvs.addPropertyValue("map['key2'].nestedIndexedBean.map[key2].name", "name0");
|
||||
pvs.add("array[0].nestedIndexedBean.array[0].name", "name5");
|
||||
pvs.add("array[1].nestedIndexedBean.array[1].name", "name4");
|
||||
pvs.add("list[0].nestedIndexedBean.list[0].name", "name3");
|
||||
pvs.add("list[1].nestedIndexedBean.list[1].name", "name2");
|
||||
pvs.add("map[key1].nestedIndexedBean.map[\"key1\"].name", "name1");
|
||||
pvs.add("map['key2'].nestedIndexedBean.map[key2].name", "name0");
|
||||
bw.setPropertyValues(pvs);
|
||||
assertEquals("arrayname5", tb0.getNestedIndexedBean().getArray()[0].getName());
|
||||
assertEquals("arrayname4", tb1.getNestedIndexedBean().getArray()[1].getName());
|
||||
@@ -1159,12 +1159,12 @@ public class CustomEditorTests {
|
||||
});
|
||||
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("array[0].nestedIndexedBean.array[0].name", "name5");
|
||||
pvs.addPropertyValue("array[1].nestedIndexedBean.array[1].name", "name4");
|
||||
pvs.addPropertyValue("list[0].nestedIndexedBean.list[0].name", "name3");
|
||||
pvs.addPropertyValue("list[1].nestedIndexedBean.list[1].name", "name2");
|
||||
pvs.addPropertyValue("map[key1].nestedIndexedBean.map[\"key1\"].name", "name1");
|
||||
pvs.addPropertyValue("map['key2'].nestedIndexedBean.map[key2].name", "name0");
|
||||
pvs.add("array[0].nestedIndexedBean.array[0].name", "name5");
|
||||
pvs.add("array[1].nestedIndexedBean.array[1].name", "name4");
|
||||
pvs.add("list[0].nestedIndexedBean.list[0].name", "name3");
|
||||
pvs.add("list[1].nestedIndexedBean.list[1].name", "name2");
|
||||
pvs.add("map[key1].nestedIndexedBean.map[\"key1\"].name", "name1");
|
||||
pvs.add("map['key2'].nestedIndexedBean.map[key2].name", "name0");
|
||||
bw.setPropertyValues(pvs);
|
||||
assertEquals("arrayname5", tb0.getNestedIndexedBean().getArray()[0].getName());
|
||||
assertEquals("name4", tb1.getNestedIndexedBean().getArray()[1].getName());
|
||||
@@ -1207,12 +1207,12 @@ public class CustomEditorTests {
|
||||
});
|
||||
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("array[0]", "a");
|
||||
pvs.addPropertyValue("array[1]", "b");
|
||||
pvs.addPropertyValue("list[0]", "c");
|
||||
pvs.addPropertyValue("list[1]", "d");
|
||||
pvs.addPropertyValue("map[key1]", "e");
|
||||
pvs.addPropertyValue("map['key2']", "f");
|
||||
pvs.add("array[0]", "a");
|
||||
pvs.add("array[1]", "b");
|
||||
pvs.add("list[0]", "c");
|
||||
pvs.add("list[1]", "d");
|
||||
pvs.add("map[key1]", "e");
|
||||
pvs.add("map['key2']", "f");
|
||||
bw.setPropertyValues(pvs);
|
||||
assertEquals("arraya", bean.getArray()[0].getName());
|
||||
assertEquals("arrayb", bean.getArray()[1].getName());
|
||||
@@ -1282,12 +1282,12 @@ public class CustomEditorTests {
|
||||
});
|
||||
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("array[0]", "a");
|
||||
pvs.addPropertyValue("array[1]", "b");
|
||||
pvs.addPropertyValue("list[0]", "c");
|
||||
pvs.addPropertyValue("list[1]", "d");
|
||||
pvs.addPropertyValue("map[key1]", "e");
|
||||
pvs.addPropertyValue("map['key2']", "f");
|
||||
pvs.add("array[0]", "a");
|
||||
pvs.add("array[1]", "b");
|
||||
pvs.add("list[0]", "c");
|
||||
pvs.add("list[1]", "d");
|
||||
pvs.add("map[key1]", "e");
|
||||
pvs.add("map['key2']", "f");
|
||||
bw.setPropertyValues(pvs);
|
||||
assertEquals("array0a", bean.getArray()[0].getName());
|
||||
assertEquals("array1b", bean.getArray()[1].getName());
|
||||
|
||||
Reference in New Issue
Block a user