Skip to content

Commit 2e4e43b

Browse files
committed
Polish org.springframework.core.env.PropertySource
See gh-30195
1 parent 6876c28 commit 2e4e43b

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

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

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ public PropertySource(String name) {
9292

9393
/**
9494
* Return the name of this {@code PropertySource}.
95+
* <p>See the {@linkplain PropertySource class-level Javadoc} for details
96+
* on property source identity and names.
9597
*/
9698
public String getName() {
9799
return this.name;
@@ -170,21 +172,22 @@ public String toString() {
170172

171173

172174
/**
173-
* Return a {@code PropertySource} implementation intended for collection comparison purposes only.
174-
* <p>Primarily for internal use, but given a collection of {@code PropertySource} objects, may be
175-
* used as follows:
175+
* Return a {@code PropertySource} implementation intended for collection
176+
* comparison purposes only.
177+
* <p>Primarily for internal use, but given a collection of {@code PropertySource}
178+
* objects, may be used as follows:
176179
* <pre class="code">
177-
* {@code List<PropertySource<?>> sources = new ArrayList<PropertySource<?>>();
180+
* List&lt;PropertySource&lt;?&gt;&gt; sources = new ArrayList&lt;&gt;();
178181
* sources.add(new MapPropertySource("sourceA", mapA));
179182
* sources.add(new MapPropertySource("sourceB", mapB));
180183
* assert sources.contains(PropertySource.named("sourceA"));
181184
* assert sources.contains(PropertySource.named("sourceB"));
182-
* assert !sources.contains(PropertySource.named("sourceC"));
183-
* }</pre>
184-
* The returned {@code PropertySource} will throw {@code UnsupportedOperationException}
185+
* assert !sources.contains(PropertySource.named("sourceC"));</pre>
186+
* <p>The returned {@code PropertySource} will throw {@code UnsupportedOperationException}
185187
* if any methods other than {@code equals(Object)}, {@code hashCode()}, and {@code toString()}
186188
* are called.
187-
* @param name the name of the comparison {@code PropertySource} to be created and returned.
189+
* @param name the name of the comparison {@code PropertySource} to be created
190+
* and returned
188191
*/
189192
public static PropertySource<?> named(String name) {
190193
return new ComparisonPropertySource(name);
@@ -206,7 +209,7 @@ public static PropertySource<?> named(String name) {
206209
public static class StubPropertySource extends PropertySource<Object> {
207210

208211
public StubPropertySource(String name) {
209-
super(name, new Object());
212+
super(name);
210213
}
211214

212215
/**

0 commit comments

Comments
 (0)