diff --git a/spring-beans/src/main/java/org/springframework/beans/MutablePropertyValues.java b/spring-beans/src/main/java/org/springframework/beans/MutablePropertyValues.java index 88955f386f..87057a1011 100644 --- a/spring-beans/src/main/java/org/springframework/beans/MutablePropertyValues.java +++ b/spring-beans/src/main/java/org/springframework/beans/MutablePropertyValues.java @@ -27,7 +27,7 @@ import org.springframework.lang.Nullable; import org.springframework.util.StringUtils; /** - * Default implementation of the {@link PropertyValues} interface. + * The default implementation of the {@link PropertyValues} interface. * Allows simple manipulation of properties, and provides constructors * to support deep copy and construction from a Map. * @@ -80,7 +80,7 @@ public class MutablePropertyValues implements PropertyValues, Serializable { /** * Construct a new MutablePropertyValues object from a Map. - * @param original Map with property values keyed by property name Strings + * @param original a Map with property values keyed by property name Strings * @see #addPropertyValues(Map) */ public MutablePropertyValues(@Nullable Map original) { @@ -101,7 +101,7 @@ public class MutablePropertyValues implements PropertyValues, Serializable { * PropertyValue objects as-is. *

This is a constructor for advanced usage scenarios. * It is not intended for typical programmatic use. - * @param propertyValueList List of PropertyValue objects + * @param propertyValueList a List of PropertyValue objects */ public MutablePropertyValues(@Nullable List propertyValueList) { this.propertyValueList = @@ -145,7 +145,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, + * @param other a Map with property values keyed by property name, * which must be a String * @return this in order to allow for adding multiple property values in a chain */ @@ -160,7 +160,7 @@ public class MutablePropertyValues implements PropertyValues, Serializable { /** * 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 + * @param pv the PropertyValue object to add * @return this in order to allow for adding multiple property values in a chain */ public MutablePropertyValues addPropertyValue(PropertyValue pv) { diff --git a/spring-beans/src/main/java/org/springframework/beans/PropertyValues.java b/spring-beans/src/main/java/org/springframework/beans/PropertyValues.java index 786354aeb8..8e0abb1427 100644 --- a/spring-beans/src/main/java/org/springframework/beans/PropertyValues.java +++ b/spring-beans/src/main/java/org/springframework/beans/PropertyValues.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2018 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. @@ -46,7 +46,7 @@ public interface PropertyValues { * Return the changes since the previous PropertyValues. * Subclasses should also override {@code equals}. * @param old old property values - * @return PropertyValues updated or new properties. + * @return the updated or new properties. * Return empty PropertyValues if there are no changes. * @see Object#equals */ diff --git a/spring-beans/src/test/java/org/springframework/beans/AbstractPropertyValuesTests.java b/spring-beans/src/test/java/org/springframework/beans/AbstractPropertyValuesTests.java index 22cf667566..5416624420 100644 --- a/spring-beans/src/test/java/org/springframework/beans/AbstractPropertyValuesTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/AbstractPropertyValuesTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2018 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. @@ -30,7 +30,7 @@ public abstract class AbstractPropertyValuesTests { /** * Must contain: forname=Tony surname=Blair age=50 */ - protected void doTestTony(PropertyValues pvs) throws Exception { + protected void doTestTony(PropertyValues pvs) { assertTrue("Contains 3", pvs.getPropertyValues().length == 3); assertTrue("Contains forname", pvs.contains("forname")); assertTrue("Contains surname", pvs.contains("surname")); @@ -52,4 +52,4 @@ public abstract class AbstractPropertyValuesTests { assertTrue("Map size is 0", m.size() == 0); } -} \ No newline at end of file +} diff --git a/spring-beans/src/test/java/org/springframework/beans/MutablePropertyValuesTests.java b/spring-beans/src/test/java/org/springframework/beans/MutablePropertyValuesTests.java index 54db575086..d2840eaf1c 100644 --- a/spring-beans/src/test/java/org/springframework/beans/MutablePropertyValuesTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/MutablePropertyValuesTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2018 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. @@ -29,7 +29,7 @@ import static org.junit.Assert.*; public class MutablePropertyValuesTests extends AbstractPropertyValuesTests { @Test - public void testValid() throws Exception { + public void testValid() { MutablePropertyValues pvs = new MutablePropertyValues(); pvs.addPropertyValue(new PropertyValue("forname", "Tony")); pvs.addPropertyValue(new PropertyValue("surname", "Blair")); @@ -44,7 +44,7 @@ public class MutablePropertyValuesTests extends AbstractPropertyValuesTests { } @Test - public void testAddOrOverride() throws Exception { + public void testAddOrOverride() { MutablePropertyValues pvs = new MutablePropertyValues(); pvs.addPropertyValue(new PropertyValue("forname", "Tony")); pvs.addPropertyValue(new PropertyValue("surname", "Blair")); @@ -59,7 +59,7 @@ public class MutablePropertyValuesTests extends AbstractPropertyValuesTests { } @Test - public void testChangesOnEquals() throws Exception { + public void testChangesOnEquals() { MutablePropertyValues pvs = new MutablePropertyValues(); pvs.addPropertyValue(new PropertyValue("forname", "Tony")); pvs.addPropertyValue(new PropertyValue("surname", "Blair")); @@ -70,7 +70,7 @@ public class MutablePropertyValuesTests extends AbstractPropertyValuesTests { } @Test - public void testChangeOfOneField() throws Exception { + public void testChangeOfOneField() { MutablePropertyValues pvs = new MutablePropertyValues(); pvs.addPropertyValue(new PropertyValue("forname", "Tony")); pvs.addPropertyValue(new PropertyValue("surname", "Blair")); diff --git a/spring-core/src/main/java/org/springframework/core/env/MutablePropertySources.java b/spring-core/src/main/java/org/springframework/core/env/MutablePropertySources.java index 5a32be44c2..bf34816576 100644 --- a/spring-core/src/main/java/org/springframework/core/env/MutablePropertySources.java +++ b/spring-core/src/main/java/org/springframework/core/env/MutablePropertySources.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2018 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. @@ -26,7 +26,7 @@ import org.apache.commons.logging.LogFactory; import org.springframework.lang.Nullable; /** - * Default implementation of the {@link PropertySources} interface. + * The default implementation of the {@link PropertySources} interface. * Allows manipulation of contained property sources and provides a constructor * for copying an existing {@code PropertySources} instance. * @@ -73,6 +73,11 @@ public class MutablePropertySources implements PropertySources { } + @Override + public Iterator> iterator() { + return this.propertySourceList.iterator(); + } + @Override public boolean contains(String name) { return this.propertySourceList.contains(PropertySource.named(name)); @@ -85,10 +90,6 @@ public class MutablePropertySources implements PropertySources { return (index != -1 ? this.propertySourceList.get(index) : null); } - @Override - public Iterator> iterator() { - return this.propertySourceList.iterator(); - } /** * Add the given property source object with highest precedence. diff --git a/spring-core/src/main/java/org/springframework/core/env/PropertySources.java b/spring-core/src/main/java/org/springframework/core/env/PropertySources.java index b4b0d7432e..f87e760057 100644 --- a/spring-core/src/main/java/org/springframework/core/env/PropertySources.java +++ b/spring-core/src/main/java/org/springframework/core/env/PropertySources.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2018 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. @@ -23,6 +23,7 @@ import org.springframework.lang.Nullable; * * @author Chris Beams * @since 3.1 + * @see PropertySource */ public interface PropertySources extends Iterable> { diff --git a/spring-core/src/test/java/org/springframework/core/env/MutablePropertySourcesTests.java b/spring-core/src/test/java/org/springframework/core/env/MutablePropertySourcesTests.java index 7ec6d966d9..1db0577007 100644 --- a/spring-core/src/test/java/org/springframework/core/env/MutablePropertySourcesTests.java +++ b/spring-core/src/test/java/org/springframework/core/env/MutablePropertySourcesTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2018 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. @@ -46,9 +46,9 @@ public class MutablePropertySourcesTests { assertThat(sources.contains("g"), is(false)); assertThat(sources.get("b"), not(nullValue())); - assertThat(sources.get("b").getProperty("p1"), equalTo((Object)"bValue")); + assertThat(sources.get("b").getProperty("p1"), equalTo("bValue")); assertThat(sources.get("d"), not(nullValue())); - assertThat(sources.get("d").getProperty("p1"), equalTo((Object)"dValue")); + assertThat(sources.get("d").getProperty("p1"), equalTo("dValue")); sources.addBefore("b", new MockPropertySource("a")); sources.addAfter("b", new MockPropertySource("c"));