Skip to content

Commit f42f223

Browse files
committed
Minor UriComponentsBuilder javadoc revision
(cherry picked from commit 545c28f)
1 parent 0313222 commit f42f223

File tree

1 file changed

+38
-41
lines changed

1 file changed

+38
-41
lines changed

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

Lines changed: 38 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2013 the original author or authors.
2+
* Copyright 2002-2014 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.
@@ -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
@@ -150,7 +150,7 @@ public static UriComponentsBuilder fromUri(URI uri) {
150150
* contains {@code '='} or {@code '&'} characters, the query string cannot
151151
* be parsed unambiguously. Such values should be substituted for URI
152152
* variables to enable correct parsing:
153-
* <pre>
153+
* <pre class="code">
154154
* String uriString = &quot;/hotels/42?filter={value}&quot;;
155155
* UriComponentsBuilder.fromUriString(uriString).buildAndExpand(&quot;hot&amp;cold&quot;);
156156
* </pre>
@@ -210,7 +210,7 @@ public static UriComponentsBuilder fromUriString(String uri) {
210210
* contains {@code '='} or {@code '&'} characters, the query string cannot
211211
* be parsed unambiguously. Such values should be substituted for URI
212212
* variables to enable correct parsing:
213-
* <pre>
213+
* <pre class="code">
214214
* String uriString = &quot;/hotels/42?filter={value}&quot;;
215215
* UriComponentsBuilder.fromUriString(uriString).buildAndExpand(&quot;hot&amp;cold&quot;);
216216
* </pre>
@@ -245,18 +245,18 @@ public static UriComponentsBuilder fromHttpUrl(String httpUrl) {
245245
// build methods
246246

247247
/**
248-
* Builds a {@code UriComponents} instance from the various components contained in this builder.
248+
* Build a {@code UriComponents} instance from the various components contained in this builder.
249249
* @return the URI components
250250
*/
251251
public UriComponents build() {
252252
return build(false);
253253
}
254254

255255
/**
256-
* Builds a {@code UriComponents} instance from the various components
256+
* Build a {@code UriComponents} instance from the various components
257257
* contained in this builder.
258258
* @param encoded whether all the components set in this builder are
259-
* encoded ({@code true}) or not ({@code false}).
259+
* encoded ({@code true}) or not ({@code false}).
260260
* @return the URI components
261261
*/
262262
public UriComponents build(boolean encoded) {
@@ -270,8 +270,8 @@ public UriComponents build(boolean encoded) {
270270
}
271271

272272
/**
273-
* Builds a {@code UriComponents} instance and replaces URI template variables
274-
* with the values from a map. This is a shortcut method, which combines
273+
* Build a {@code UriComponents} instance and replaces URI template variables
274+
* with the values from a map. This is a shortcut method which combines
275275
* calls to {@link #build()} and then {@link UriComponents#expand(Map)}.
276276
* @param uriVariables the map of URI variables
277277
* @return the URI components with expanded values
@@ -281,8 +281,8 @@ public UriComponents buildAndExpand(Map<String, ?> uriVariables) {
281281
}
282282

283283
/**
284-
* Builds a {@code UriComponents} instance and replaces URI template variables
285-
* with the values from an array. This is a shortcut method, which combines
284+
* Build a {@code UriComponents} instance and replaces URI template variables
285+
* with the values from an array. This is a shortcut method which combines
286286
* calls to {@link #build()} and then {@link UriComponents#expand(Object...)}.
287287
* @param uriVariableValues URI variable values
288288
* @return the URI components with expanded values
@@ -295,7 +295,7 @@ public UriComponents buildAndExpand(Object... uriVariableValues) {
295295
// URI components methods
296296

297297
/**
298-
* Initializes all components of this URI builder with the components of the given URI.
298+
* Initialize all components of this URI builder with the components of the given URI.
299299
* @param uri the URI
300300
* @return this UriComponentsBuilder
301301
*/
@@ -344,7 +344,7 @@ private void resetSchemeSpecificPart() {
344344
}
345345

346346
/**
347-
* Sets the URI scheme. The given scheme may contain URI template variables,
347+
* Set the URI scheme. The given scheme may contain URI template variables,
348348
* and may also be {@code null} to clear the scheme of this builder.
349349
* @param scheme the URI scheme
350350
* @return this UriComponentsBuilder
@@ -369,9 +369,8 @@ public UriComponentsBuilder schemeSpecificPart(String ssp) {
369369
}
370370

371371
/**
372-
* Sets the URI user info. The given user info may contain URI template
373-
* variables, and may also be {@code null} to clear the user info of this
374-
* builder.
372+
* Set the URI user info. The given user info may contain URI template variables,
373+
* and may also be {@code null} to clear the user info of this builder.
375374
* @param userInfo the URI user info
376375
* @return this UriComponentsBuilder
377376
*/
@@ -382,8 +381,8 @@ public UriComponentsBuilder userInfo(String userInfo) {
382381
}
383382

384383
/**
385-
* Sets the URI host. The given host may contain URI template variables, and
386-
* may also be {@code null} to clear the host of this builder.
384+
* Set the URI host. The given host may contain URI template variables,
385+
* and may also be {@code null} to clear the host of this builder.
387386
* @param host the URI host
388387
* @return this UriComponentsBuilder
389388
*/
@@ -394,7 +393,7 @@ public UriComponentsBuilder host(String host) {
394393
}
395394

396395
/**
397-
* Sets the URI port. Passing {@code -1} will clear the port of this builder.
396+
* Set the URI port. Passing {@code -1} will clear the port of this builder.
398397
* @param port the URI port
399398
* @return this UriComponentsBuilder
400399
*/
@@ -406,8 +405,8 @@ public UriComponentsBuilder port(int port) {
406405
}
407406

408407
/**
409-
* Appends the given path to the existing path of this builder. The given
410-
* path may contain URI template variables.
408+
* Append the given path to the existing path of this builder.
409+
* The given path may contain URI template variables.
411410
* @param path the URI path
412411
* @return this UriComponentsBuilder
413412
*/
@@ -418,7 +417,7 @@ public UriComponentsBuilder path(String path) {
418417
}
419418

420419
/**
421-
* Sets the path of this builder overriding all existing path and path segment values.
420+
* Set the path of this builder overriding all existing path and path segment values.
422421
* @param path the URI path; a {@code null} value results in an empty path.
423422
* @return this UriComponentsBuilder
424423
*/
@@ -429,8 +428,8 @@ public UriComponentsBuilder replacePath(String path) {
429428
}
430429

431430
/**
432-
* Appends the given path segments to the existing path of this builder. Each given
433-
* path segments may contain URI template variables.
431+
* Append the given path segments to the existing path of this builder.
432+
* Each given path segment may contain URI template variables.
434433
* @param pathSegments the URI path segments
435434
* @return this UriComponentsBuilder
436435
*/
@@ -442,14 +441,14 @@ public UriComponentsBuilder pathSegment(String... pathSegments) throws IllegalAr
442441
}
443442

444443
/**
445-
* Appends the given query to the existing query of this builder.
444+
* Append the given query to the existing query of this builder.
446445
* The given query may contain URI template variables.
447446
* <p><strong>Note:</strong> The presence of reserved characters can prevent
448447
* correct parsing of the URI string. For example if a query parameter
449448
* contains {@code '='} or {@code '&'} characters, the query string cannot
450449
* be parsed unambiguously. Such values should be substituted for URI
451450
* variables to enable correct parsing:
452-
* <pre>
451+
* <pre class="code">
453452
* String uriString = &quot;/hotels/42?filter={value}&quot;;
454453
* UriComponentsBuilder.fromUriString(uriString).buildAndExpand(&quot;hot&amp;cold&quot;);
455454
* </pre>
@@ -475,7 +474,7 @@ public UriComponentsBuilder query(String query) {
475474
}
476475

477476
/**
478-
* Sets the query of this builder overriding all existing query parameters.
477+
* Set the query of this builder overriding all existing query parameters.
479478
* @param query the query string; a {@code null} value removes all query parameters.
480479
* @return this UriComponentsBuilder
481480
*/
@@ -487,7 +486,7 @@ public UriComponentsBuilder replaceQuery(String query) {
487486
}
488487

489488
/**
490-
* Appends the given query parameter to the existing query parameters. The
489+
* Append the given query parameter to the existing query parameters. The
491490
* given name or any of the values may contain URI template variables. If no
492491
* values are given, the resulting URI will contain the query parameter name
493492
* only (i.e. {@code ?foo} instead of {@code ?foo=bar}.
@@ -511,9 +510,8 @@ public UriComponentsBuilder queryParam(String name, Object... values) {
511510
}
512511

513512
/**
514-
* Sets the query parameter values overriding all existing query values for
515-
* the same parameter. If no values are given, the query parameter is
516-
* removed.
513+
* Set the query parameter values overriding all existing query values for
514+
* the same parameter. If no values are given, the query parameter is removed.
517515
* @param name the query parameter name
518516
* @param values the query parameter values
519517
* @return this UriComponentsBuilder
@@ -529,9 +527,8 @@ public UriComponentsBuilder replaceQueryParam(String name, Object... values) {
529527
}
530528

531529
/**
532-
* Sets the URI fragment. The given fragment may contain URI template
533-
* variables, and may also be {@code null} to clear the fragment of this
534-
* builder.
530+
* Set the URI fragment. The given fragment may contain URI template variables,
531+
* and may also be {@code null} to clear the fragment of this builder.
535532
* @param fragment the URI fragment
536533
* @return this UriComponentsBuilder
537534
*/

0 commit comments

Comments
 (0)