Skip to content

Commit 54636b3

Browse files
committed
Further UriComponentsBuilder javadoc revision
1 parent 545c28f commit 54636b3

File tree

2 files changed

+49
-51
lines changed

2 files changed

+49
-51
lines changed

spring-web/src/main/java/org/springframework/web/util/UriComponents.java

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@
3030
import org.springframework.util.MultiValueMap;
3131

3232
/**
33-
* Represents an immutable collection of URI components, mapping component type to String
34-
* values. Contains convenience getters for all components. Effectively similar to {@link
35-
* java.net.URI}, but with more powerful encoding options and support for URI template
36-
* variables.
33+
* Represents an immutable collection of URI components, mapping component type to
34+
* String values. Contains convenience getters for all components. Effectively similar
35+
* to {@link java.net.URI}, but with more powerful encoding options and support for
36+
* URI template variables.
3737
*
3838
* @author Arjen Poutsma
3939
* @since 3.1
@@ -135,43 +135,43 @@ public final UriComponents encode() {
135135
* Encode all URI components using their specific encoding rules, and
136136
* returns the result as a new {@code UriComponents} instance.
137137
* @param encoding the encoding of the values contained in this map
138-
* @return the encoded uri components
138+
* @return the encoded URI components
139139
* @throws UnsupportedEncodingException if the given encoding is not supported
140140
*/
141141
public abstract UriComponents encode(String encoding) throws UnsupportedEncodingException;
142142

143143
/**
144-
* Replace all URI template variables with the values from a given map. The map keys
145-
* represent variable names; the values variable values. The order of variables is not
146-
* significant.
144+
* Replace all URI template variables with the values from a given map.
145+
* <p>The given map keys represent variable names; the corresponding values
146+
* represent variable values. The order of variables is not significant.
147147
* @param uriVariables the map of URI variables
148-
* @return the expanded uri components
148+
* @return the expanded URI components
149149
*/
150150
public final UriComponents expand(Map<String, ?> uriVariables) {
151151
Assert.notNull(uriVariables, "'uriVariables' must not be null");
152152
return expandInternal(new MapTemplateVariables(uriVariables));
153153
}
154154

155155
/**
156-
* Replace all URI template variables with the values from a given array. The array
157-
* represent variable values. The order of variables is significant.
158-
* @param uriVariableValues URI variable values
159-
* @return the expanded uri components
156+
* Replace all URI template variables with the values from a given array.
157+
* <p>The given array represents variable values. The order of variables is significant.
158+
* @param uriVariableValues the URI variable values
159+
* @return the expanded URI components
160160
*/
161161
public final UriComponents expand(Object... uriVariableValues) {
162162
Assert.notNull(uriVariableValues, "'uriVariableValues' must not be null");
163163
return expandInternal(new VarArgsTemplateVariables(uriVariableValues));
164164
}
165165

166166
/**
167-
* Replace all URI template variables with the values obtained through the
168-
* given {@link UriTemplateVariables} instance.
169-
* @param uriTemplateVars resolves URI template variable values
170-
* @return the expanded uri components
167+
* Replace all URI template variables with the values from the given
168+
* {@link UriTemplateVariables}.
169+
* @param uriVariables the URI template values
170+
* @return the expanded URI components
171171
*/
172-
public final UriComponents expand(UriTemplateVariables uriTemplateVars) {
173-
Assert.notNull(uriTemplateVars, "'uriTemplateVars' must not be null");
174-
return expandInternal(uriTemplateVars);
172+
public final UriComponents expand(UriTemplateVariables uriVariables) {
173+
Assert.notNull(uriVariables, "'uriVariables' must not be null");
174+
return expandInternal(uriVariables);
175175
}
176176

177177
/**

spring-web/src/main/java/org/springframework/web/util/UriComponentsBuilder.java

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@
3434
/**
3535
* Builder for {@link UriComponents}.
3636
*
37-
* <p></p>Typical usage involves:
37+
* <p>Typical usage involves:
3838
* <ol>
39-
* <li>Create a {@code UriComponentsBuilder} with one of the static factory methods (such as
40-
* {@link #fromPath(String)} or {@link #fromUri(URI)})</li>
41-
* <li>Set the various URI components through the respective methods ({@link #scheme(String)},
42-
* {@link #userInfo(String)}, {@link #host(String)}, {@link #port(int)}, {@link #path(String)},
43-
* {@link #pathSegment(String...)}, {@link #queryParam(String, Object...)}, and
44-
* {@link #fragment(String)}.</li>
45-
* <li>Build the {@link UriComponents} instance with the {@link #build()} method.</li>
39+
* <li>Create a {@code UriComponentsBuilder} with one of the static factory methods
40+
* (such as {@link #fromPath(String)} or {@link #fromUri(URI)})</li>
41+
* <li>Set the various URI components through the respective methods ({@link #scheme(String)},
42+
* {@link #userInfo(String)}, {@link #host(String)}, {@link #port(int)}, {@link #path(String)},
43+
* {@link #pathSegment(String...)}, {@link #queryParam(String, Object...)}, and
44+
* {@link #fragment(String)}.</li>
45+
* <li>Build the {@link UriComponents} instance with the {@link #build()} method.</li>
4646
* </ol>
4747
*
4848
* @author Arjen Poutsma
@@ -303,7 +303,7 @@ public UriComponents buildAndExpand(Object... uriVariableValues) {
303303
// URI components methods
304304

305305
/**
306-
* Initializes all components of this URI builder with the components of the given URI.
306+
* Initialize all components of this URI builder with the components of the given URI.
307307
* @param uri the URI
308308
* @return this UriComponentsBuilder
309309
*/
@@ -352,7 +352,7 @@ private void resetSchemeSpecificPart() {
352352
}
353353

354354
/**
355-
* Sets the URI scheme. The given scheme may contain URI template variables,
355+
* Set the URI scheme. The given scheme may contain URI template variables,
356356
* and may also be {@code null} to clear the scheme of this builder.
357357
* @param scheme the URI scheme
358358
* @return this UriComponentsBuilder
@@ -421,9 +421,8 @@ public UriComponentsBuilder schemeSpecificPart(String ssp) {
421421
}
422422

423423
/**
424-
* Sets the URI user info. The given user info may contain URI template
425-
* variables, and may also be {@code null} to clear the user info of this
426-
* builder.
424+
* Set the URI user info. The given user info may contain URI template variables,
425+
* and may also be {@code null} to clear the user info of this builder.
427426
* @param userInfo the URI user info
428427
* @return this UriComponentsBuilder
429428
*/
@@ -434,8 +433,8 @@ public UriComponentsBuilder userInfo(String userInfo) {
434433
}
435434

436435
/**
437-
* Sets the URI host. The given host may contain URI template variables, and
438-
* may also be {@code null} to clear the host of this builder.
436+
* Set the URI host. The given host may contain URI template variables,
437+
* and may also be {@code null} to clear the host of this builder.
439438
* @param host the URI host
440439
* @return this UriComponentsBuilder
441440
*/
@@ -446,7 +445,7 @@ public UriComponentsBuilder host(String host) {
446445
}
447446

448447
/**
449-
* Sets the URI port. Passing {@code -1} will clear the port of this builder.
448+
* Set the URI port. Passing {@code -1} will clear the port of this builder.
450449
* @param port the URI port
451450
* @return this UriComponentsBuilder
452451
*/
@@ -458,8 +457,8 @@ public UriComponentsBuilder port(int port) {
458457
}
459458

460459
/**
461-
* Appends the given path to the existing path of this builder. The given
462-
* path may contain URI template variables.
460+
* Append the given path to the existing path of this builder.
461+
* The given path may contain URI template variables.
463462
* @param path the URI path
464463
* @return this UriComponentsBuilder
465464
*/
@@ -470,7 +469,7 @@ public UriComponentsBuilder path(String path) {
470469
}
471470

472471
/**
473-
* Sets the path of this builder overriding all existing path and path segment values.
472+
* Set the path of this builder overriding all existing path and path segment values.
474473
* @param path the URI path; a {@code null} value results in an empty path.
475474
* @return this UriComponentsBuilder
476475
*/
@@ -481,8 +480,8 @@ public UriComponentsBuilder replacePath(String path) {
481480
}
482481

483482
/**
484-
* Appends the given path segments to the existing path of this builder. Each given
485-
* path segments may contain URI template variables.
483+
* Append the given path segments to the existing path of this builder.
484+
* Each given path segment may contain URI template variables.
486485
* @param pathSegments the URI path segments
487486
* @return this UriComponentsBuilder
488487
*/
@@ -494,7 +493,7 @@ public UriComponentsBuilder pathSegment(String... pathSegments) throws IllegalAr
494493
}
495494

496495
/**
497-
* Appends the given query to the existing query of this builder.
496+
* Append the given query to the existing query of this builder.
498497
* The given query may contain URI template variables.
499498
* <p><strong>Note:</strong> The presence of reserved characters can prevent
500499
* correct parsing of the URI string. For example if a query parameter
@@ -527,7 +526,7 @@ public UriComponentsBuilder query(String query) {
527526
}
528527

529528
/**
530-
* Sets the query of this builder overriding all existing query parameters.
529+
* Set the query of this builder overriding all existing query parameters.
531530
* @param query the query string; a {@code null} value removes all query parameters.
532531
* @return this UriComponentsBuilder
533532
*/
@@ -539,7 +538,7 @@ public UriComponentsBuilder replaceQuery(String query) {
539538
}
540539

541540
/**
542-
* Appends the given query parameter to the existing query parameters. The
541+
* Append the given query parameter to the existing query parameters. The
543542
* given name or any of the values may contain URI template variables. If no
544543
* values are given, the resulting URI will contain the query parameter name
545544
* only (i.e. {@code ?foo} instead of {@code ?foo=bar}.
@@ -563,7 +562,7 @@ public UriComponentsBuilder queryParam(String name, Object... values) {
563562
}
564563

565564
/**
566-
* Adds the given query parameters.
565+
* Add the given query parameters.
567566
* @param params the params
568567
* @return this UriComponentsBuilder
569568
*/
@@ -574,9 +573,8 @@ public UriComponentsBuilder queryParams(MultiValueMap<String, String> params) {
574573
}
575574

576575
/**
577-
* Sets the query parameter values overriding all existing query values for
578-
* the same parameter. If no values are given, the query parameter is
579-
* removed.
576+
* Set the query parameter values overriding all existing query values for
577+
* the same parameter. If no values are given, the query parameter is removed.
580578
* @param name the query parameter name
581579
* @param values the query parameter values
582580
* @return this UriComponentsBuilder
@@ -592,9 +590,8 @@ public UriComponentsBuilder replaceQueryParam(String name, Object... values) {
592590
}
593591

594592
/**
595-
* Sets the URI fragment. The given fragment may contain URI template
596-
* variables, and may also be {@code null} to clear the fragment of this
597-
* builder.
593+
* Set the URI fragment. The given fragment may contain URI template variables,
594+
* and may also be {@code null} to clear the fragment of this builder.
598595
* @param fragment the URI fragment
599596
* @return this UriComponentsBuilder
600597
*/
@@ -615,6 +612,7 @@ private interface PathComponentBuilder {
615612
PathComponent build();
616613
}
617614

615+
618616
private static class CompositePathComponentBuilder implements PathComponentBuilder {
619617

620618
private final LinkedList<PathComponentBuilder> componentBuilders = new LinkedList<PathComponentBuilder>();

0 commit comments

Comments
 (0)