|
55 | 55 | */
|
56 | 56 | public class UriTemplate {
|
57 | 57 |
|
58 |
| - static final Map<Character, CompositeOutput> COMPOSITE_PREFIXES = |
| 58 | + private static final Map<Character, CompositeOutput> COMPOSITE_PREFIXES = |
59 | 59 | new HashMap<Character, CompositeOutput>();
|
60 | 60 |
|
61 | 61 | static {
|
@@ -98,14 +98,14 @@ private enum CompositeOutput {
|
98 | 98 | private final boolean reservedExpansion;
|
99 | 99 |
|
100 | 100 | /**
|
101 |
| - * @param propertyPrefix The prefix of a parameter or {@code null} for none. In {+var} the |
| 101 | + * @param propertyPrefix the prefix of a parameter or {@code null} for none. In {+var} the |
102 | 102 | * prefix is '+'
|
103 |
| - * @param outputPrefix The string that should be prefixed to the expanded template. |
104 |
| - * @param explodeJoiner The delimiter used to join composite values. |
105 |
| - * @param requiresVarAssignment Denotes whether or not the expanded template should contain an |
106 |
| - * assignment with the variable. |
107 |
| - * @param reservedExpansion Reserved expansion allows pct-encoded triplets and characters in the |
108 |
| - * reserved set. |
| 103 | + * @param outputPrefix the string that should be prefixed to the expanded template. |
| 104 | + * @param explodeJoiner the delimiter used to join composite values. |
| 105 | + * @param requiresVarAssignment denotes whether or not the expanded template should contain an |
| 106 | + * assignment with the variable |
| 107 | + * @param reservedExpansion reserved expansion allows percent-encoded triplets and characters in the |
| 108 | + * reserved set |
109 | 109 | */
|
110 | 110 | CompositeOutput(
|
111 | 111 | Character propertyPrefix,
|
@@ -149,26 +149,22 @@ int getVarNameStartIndex() {
|
149 | 149 | }
|
150 | 150 |
|
151 | 151 | /**
|
152 |
| - * Encodes the specified value. If reserved expansion is turned on then pct-encoded triplets and |
| 152 | + * Encodes the specified value. If reserved expansion is turned on, then percent-encoded triplets and |
153 | 153 | * characters are allowed in the reserved set.
|
154 | 154 | *
|
155 |
| - * @param value The string to be encoded. |
156 |
| - * @return The encoded string. |
| 155 | + * @param value the string to be encoded |
| 156 | + * @return the encoded string |
157 | 157 | */
|
158 |
| - String getEncodedValue(String value) { |
| 158 | + private String getEncodedValue(String value) { |
159 | 159 | String encodedValue;
|
160 | 160 | if (reservedExpansion) {
|
161 |
| - // Reserved expansion allows pct-encoded triplets and characters in the reserved set. |
| 161 | + // Reserved expansion allows percent-encoded triplets and characters in the reserved set. |
162 | 162 | encodedValue = CharEscapers.escapeUriPathWithoutReserved(value);
|
163 | 163 | } else {
|
164 |
| - encodedValue = CharEscapers.escapeUri(value); |
| 164 | + encodedValue = CharEscapers.escapeUriConformant(value); |
165 | 165 | }
|
166 | 166 | return encodedValue;
|
167 | 167 | }
|
168 |
| - |
169 |
| - boolean getReservedExpansion() { |
170 |
| - return reservedExpansion; |
171 |
| - } |
172 | 168 | }
|
173 | 169 |
|
174 | 170 | static CompositeOutput getCompositeOutput(String propertyName) {
|
@@ -334,12 +330,12 @@ private static String getSimpleValue(String name, String value, CompositeOutput
|
334 | 330 | * Expand the template of a composite list property. Eg: If d := ["red", "green", "blue"] then
|
335 | 331 | * {/d*} is expanded to "/red/green/blue"
|
336 | 332 | *
|
337 |
| - * @param varName The name of the variable the value corresponds to. Eg: "d" |
338 |
| - * @param iterator The iterator over list values. Eg: ["red", "green", "blue"] |
339 |
| - * @param containsExplodeModifier Set to true if the template contains the explode modifier "*" |
340 |
| - * @param compositeOutput An instance of CompositeOutput. Contains information on how the |
| 333 | + * @param varName the name of the variable the value corresponds to. E.g. "d" |
| 334 | + * @param iterator the iterator over list values. E.g. ["red", "green", "blue"] |
| 335 | + * @param containsExplodeModifiersSet to true if the template contains the explode modifier "*" |
| 336 | + * @param compositeOutput an instance of CompositeOutput. Contains information on how the |
341 | 337 | * expansion should be done
|
342 |
| - * @return The expanded list template |
| 338 | + * @return the expanded list template |
343 | 339 | * @throws IllegalArgumentException if the required list path parameter is empty
|
344 | 340 | */
|
345 | 341 | private static String getListPropertyValue(
|
@@ -378,12 +374,11 @@ private static String getListPropertyValue(
|
378 | 374 | * Expand the template of a composite map property. Eg: If d := [("semi", ";"),("dot",
|
379 | 375 | * "."),("comma", ",")] then {/d*} is expanded to "/semi=%3B/dot=./comma=%2C"
|
380 | 376 | *
|
381 |
| - * @param varName The name of the variable the value corresponds to. Eg: "d" |
382 |
| - * @param map The map property value. Eg: [("semi", ";"),("dot", "."),("comma", ",")] |
| 377 | + * @param varName the name of the variable the value corresponds to. Eg: "d" |
| 378 | + * @param map the map property value. Eg: [("semi", ";"),("dot", "."),("comma", ",")] |
383 | 379 | * @param containsExplodeModifier Set to true if the template contains the explode modifier "*"
|
384 |
| - * @param compositeOutput An instance of CompositeOutput. Contains information on how the |
385 |
| - * expansion should be done |
386 |
| - * @return The expanded map template |
| 380 | + * @param compositeOutput contains information on how the expansion should be done |
| 381 | + * @return the expanded map template |
387 | 382 | * @throws IllegalArgumentException if the required list path parameter is map
|
388 | 383 | */
|
389 | 384 | private static String getMapPropertyValue(
|
|
0 commit comments