Skip to content

Commit 43868d2

Browse files
committed
Polishing
1 parent a8b747c commit 43868d2

File tree

7 files changed

+27
-25
lines changed

7 files changed

+27
-25
lines changed

spring-beans/src/main/java/org/springframework/beans/MutablePropertyValues.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import org.springframework.util.StringUtils;
2828

2929
/**
30-
* Default implementation of the {@link PropertyValues} interface.
30+
* The default implementation of the {@link PropertyValues} interface.
3131
* Allows simple manipulation of properties, and provides constructors
3232
* to support deep copy and construction from a Map.
3333
*
@@ -80,7 +80,7 @@ public MutablePropertyValues(@Nullable PropertyValues original) {
8080

8181
/**
8282
* Construct a new MutablePropertyValues object from a Map.
83-
* @param original Map with property values keyed by property name Strings
83+
* @param original a Map with property values keyed by property name Strings
8484
* @see #addPropertyValues(Map)
8585
*/
8686
public MutablePropertyValues(@Nullable Map<?, ?> original) {
@@ -101,7 +101,7 @@ public MutablePropertyValues(@Nullable Map<?, ?> original) {
101101
* PropertyValue objects as-is.
102102
* <p>This is a constructor for advanced usage scenarios.
103103
* It is not intended for typical programmatic use.
104-
* @param propertyValueList List of PropertyValue objects
104+
* @param propertyValueList a List of PropertyValue objects
105105
*/
106106
public MutablePropertyValues(@Nullable List<PropertyValue> propertyValueList) {
107107
this.propertyValueList =
@@ -145,7 +145,7 @@ public MutablePropertyValues addPropertyValues(@Nullable PropertyValues other) {
145145

146146
/**
147147
* Add all property values from the given Map.
148-
* @param other Map with property values keyed by property name,
148+
* @param other a Map with property values keyed by property name,
149149
* which must be a String
150150
* @return this in order to allow for adding multiple property values in a chain
151151
*/
@@ -160,7 +160,7 @@ public MutablePropertyValues addPropertyValues(@Nullable Map<?, ?> other) {
160160
/**
161161
* Add a PropertyValue object, replacing any existing one for the
162162
* corresponding property or getting merged with it (if applicable).
163-
* @param pv PropertyValue object to add
163+
* @param pv the PropertyValue object to add
164164
* @return this in order to allow for adding multiple property values in a chain
165165
*/
166166
public MutablePropertyValues addPropertyValue(PropertyValue pv) {

spring-beans/src/main/java/org/springframework/beans/PropertyValues.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -46,7 +46,7 @@ public interface PropertyValues {
4646
* Return the changes since the previous PropertyValues.
4747
* Subclasses should also override {@code equals}.
4848
* @param old old property values
49-
* @return PropertyValues updated or new properties.
49+
* @return the updated or new properties.
5050
* Return empty PropertyValues if there are no changes.
5151
* @see Object#equals
5252
*/

spring-beans/src/test/java/org/springframework/beans/AbstractPropertyValuesTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2016 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -30,7 +30,7 @@ public abstract class AbstractPropertyValuesTests {
3030
/**
3131
* Must contain: forname=Tony surname=Blair age=50
3232
*/
33-
protected void doTestTony(PropertyValues pvs) throws Exception {
33+
protected void doTestTony(PropertyValues pvs) {
3434
assertTrue("Contains 3", pvs.getPropertyValues().length == 3);
3535
assertTrue("Contains forname", pvs.contains("forname"));
3636
assertTrue("Contains surname", pvs.contains("surname"));
@@ -52,4 +52,4 @@ protected void doTestTony(PropertyValues pvs) throws Exception {
5252
assertTrue("Map size is 0", m.size() == 0);
5353
}
5454

55-
}
55+
}

spring-beans/src/test/java/org/springframework/beans/MutablePropertyValuesTests.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -29,7 +29,7 @@
2929
public class MutablePropertyValuesTests extends AbstractPropertyValuesTests {
3030

3131
@Test
32-
public void testValid() throws Exception {
32+
public void testValid() {
3333
MutablePropertyValues pvs = new MutablePropertyValues();
3434
pvs.addPropertyValue(new PropertyValue("forname", "Tony"));
3535
pvs.addPropertyValue(new PropertyValue("surname", "Blair"));
@@ -44,7 +44,7 @@ public void testValid() throws Exception {
4444
}
4545

4646
@Test
47-
public void testAddOrOverride() throws Exception {
47+
public void testAddOrOverride() {
4848
MutablePropertyValues pvs = new MutablePropertyValues();
4949
pvs.addPropertyValue(new PropertyValue("forname", "Tony"));
5050
pvs.addPropertyValue(new PropertyValue("surname", "Blair"));
@@ -59,7 +59,7 @@ public void testAddOrOverride() throws Exception {
5959
}
6060

6161
@Test
62-
public void testChangesOnEquals() throws Exception {
62+
public void testChangesOnEquals() {
6363
MutablePropertyValues pvs = new MutablePropertyValues();
6464
pvs.addPropertyValue(new PropertyValue("forname", "Tony"));
6565
pvs.addPropertyValue(new PropertyValue("surname", "Blair"));
@@ -70,7 +70,7 @@ public void testChangesOnEquals() throws Exception {
7070
}
7171

7272
@Test
73-
public void testChangeOfOneField() throws Exception {
73+
public void testChangeOfOneField() {
7474
MutablePropertyValues pvs = new MutablePropertyValues();
7575
pvs.addPropertyValue(new PropertyValue("forname", "Tony"));
7676
pvs.addPropertyValue(new PropertyValue("surname", "Blair"));

spring-core/src/main/java/org/springframework/core/env/MutablePropertySources.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -26,7 +26,7 @@
2626
import org.springframework.lang.Nullable;
2727

2828
/**
29-
* Default implementation of the {@link PropertySources} interface.
29+
* The default implementation of the {@link PropertySources} interface.
3030
* Allows manipulation of contained property sources and provides a constructor
3131
* for copying an existing {@code PropertySources} instance.
3232
*
@@ -73,6 +73,11 @@ public MutablePropertySources(PropertySources propertySources) {
7373
}
7474

7575

76+
@Override
77+
public Iterator<PropertySource<?>> iterator() {
78+
return this.propertySourceList.iterator();
79+
}
80+
7681
@Override
7782
public boolean contains(String name) {
7883
return this.propertySourceList.contains(PropertySource.named(name));
@@ -85,10 +90,6 @@ public PropertySource<?> get(String name) {
8590
return (index != -1 ? this.propertySourceList.get(index) : null);
8691
}
8792

88-
@Override
89-
public Iterator<PropertySource<?>> iterator() {
90-
return this.propertySourceList.iterator();
91-
}
9293

9394
/**
9495
* Add the given property source object with highest precedence.

spring-core/src/main/java/org/springframework/core/env/PropertySources.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2011 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -23,6 +23,7 @@
2323
*
2424
* @author Chris Beams
2525
* @since 3.1
26+
* @see PropertySource
2627
*/
2728
public interface PropertySources extends Iterable<PropertySource<?>> {
2829

spring-core/src/test/java/org/springframework/core/env/MutablePropertySourcesTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2014 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -46,9 +46,9 @@ public void test() {
4646
assertThat(sources.contains("g"), is(false));
4747

4848
assertThat(sources.get("b"), not(nullValue()));
49-
assertThat(sources.get("b").getProperty("p1"), equalTo((Object)"bValue"));
49+
assertThat(sources.get("b").getProperty("p1"), equalTo("bValue"));
5050
assertThat(sources.get("d"), not(nullValue()));
51-
assertThat(sources.get("d").getProperty("p1"), equalTo((Object)"dValue"));
51+
assertThat(sources.get("d").getProperty("p1"), equalTo("dValue"));
5252

5353
sources.addBefore("b", new MockPropertySource("a"));
5454
sources.addAfter("b", new MockPropertySource("c"));

0 commit comments

Comments
 (0)