29
29
30
30
/**
31
31
* A single template variable.
32
- *
32
+ *
33
33
* @author Oliver Gierke
34
34
* @author JamesE Richardson
35
35
*/
@@ -45,7 +45,7 @@ public final class TemplateVariable implements Serializable {
45
45
46
46
/**
47
47
* Creates a new {@link TemplateVariable} with the given name and type.
48
- *
48
+ *
49
49
* @param name must not be {@literal null} or empty.
50
50
* @param type must not be {@literal null}.
51
51
*/
@@ -55,7 +55,7 @@ public TemplateVariable(String name, TemplateVariable.VariableType type) {
55
55
56
56
/**
57
57
* Creates a new {@link TemplateVariable} with the given name, type and description.
58
- *
58
+ *
59
59
* @param name must not be {@literal null} or empty.
60
60
* @param type must not be {@literal null}.
61
61
* @param description must not be {@literal null}.
@@ -74,38 +74,42 @@ public TemplateVariable(String name, TemplateVariable.VariableType type, String
74
74
/**
75
75
* Static helper to fashion {@link VariableType#PATH_VARIABLE} variables.
76
76
*
77
- * @param pathVariable
77
+ * @param variable must not be {@literal null} or empty.
78
78
* @return
79
+ * @since 1.1
79
80
*/
80
- public static TemplateVariable pathVariable (String pathVariable ) {
81
- return new TemplateVariable (pathVariable , VariableType .PATH_VARIABLE );
81
+ public static TemplateVariable pathVariable (String variable ) {
82
+ return new TemplateVariable (variable , VariableType .PATH_VARIABLE );
82
83
}
83
84
84
85
/**
85
86
* Static helper to fashion {@link VariableType#REQUEST_PARAM} variables.
86
87
*
87
- * @param requestParam
88
+ * @param parameter must not be {@literal null} or empty.
88
89
* @return
90
+ * @since 1.1
89
91
*/
90
- public static TemplateVariable requestParam (String requestParam ) {
91
- return new TemplateVariable (requestParam , VariableType .REQUEST_PARAM );
92
+ public static TemplateVariable requestParameter (String parameter ) {
93
+ return new TemplateVariable (parameter , VariableType .REQUEST_PARAM );
92
94
}
93
95
94
96
/**
95
97
* Static helper to fashion {@link VariableType#REQUEST_PARAM_CONTINUED} variables.
96
98
*
97
- * @param requestParam
99
+ * @param parameter must not be {@literal null} or empty.
98
100
* @return
101
+ * @since 1.1
99
102
*/
100
- public static TemplateVariable requestParamContinued (String requestParam ) {
101
- return new TemplateVariable (requestParam , VariableType .REQUEST_PARAM_CONTINUED );
103
+ public static TemplateVariable requestParameterContinued (String parameter ) {
104
+ return new TemplateVariable (parameter , VariableType .REQUEST_PARAM_CONTINUED );
102
105
}
103
106
104
107
/**
105
108
* Static helper to fashion {@link VariableType#SEGMENT} variables.
106
109
*
107
- * @param segment
110
+ * @param segment must not be {@literal null} or empty.
108
111
* @return
112
+ * @since 1.1
109
113
*/
110
114
public static TemplateVariable segment (String segment ) {
111
115
return new TemplateVariable (segment , VariableType .SEGMENT );
@@ -114,8 +118,9 @@ public static TemplateVariable segment(String segment) {
114
118
/**
115
119
* Static helper to fashion {@link VariableType#FRAGMENT} variables.
116
120
*
117
- * @param fragment
121
+ * @param fragment must not be {@literal null} or empty.
118
122
* @return
123
+ * @since 1.1
119
124
*/
120
125
public static TemplateVariable fragment (String fragment ) {
121
126
return new TemplateVariable (fragment , VariableType .FRAGMENT );
@@ -124,16 +129,17 @@ public static TemplateVariable fragment(String fragment) {
124
129
/**
125
130
* Static helper to fashion {@link VariableType#COMPOSITE_PARAM} variables.
126
131
*
127
- * @param compositeParam
132
+ * @param parameter must not be {@literal null} or empty.
128
133
* @return
134
+ * @since 1.1
129
135
*/
130
- public static TemplateVariable compositeParam (String compositeParam ) {
131
- return new TemplateVariable (compositeParam , VariableType .COMPOSITE_PARAM );
136
+ public static TemplateVariable compositeParameter (String parameter ) {
137
+ return new TemplateVariable (parameter , VariableType .COMPOSITE_PARAM );
132
138
}
133
-
139
+
134
140
/**
135
141
* Returns whether the variable has a description.
136
- *
142
+ *
137
143
* @return
138
144
*/
139
145
public boolean hasDescription () {
@@ -143,7 +149,7 @@ public boolean hasDescription() {
143
149
/**
144
150
* Returns whether the template variable is optional, which means the template can be expanded to a URI without a
145
151
* value given for that variable.
146
- *
152
+ *
147
153
* @return
148
154
*/
149
155
boolean isRequired () {
@@ -152,7 +158,7 @@ boolean isRequired() {
152
158
153
159
/**
154
160
* Returns whether the given {@link TemplateVariable} is of the same type as the current one.
155
- *
161
+ *
156
162
* @param variable must not be {@literal null}.
157
163
* @return
158
164
*/
@@ -163,7 +169,7 @@ boolean isCombinable(TemplateVariable variable) {
163
169
/**
164
170
* Returns whether the given {@link TemplateVariable} is logically equivalent to the given one. This considers request
165
171
* parameter variables equivalent independently from whether they're continued or not.
166
- *
172
+ *
167
173
* @param variable
168
174
* @return
169
175
*/
@@ -173,7 +179,7 @@ boolean isEquivalent(TemplateVariable variable) {
173
179
174
180
/**
175
181
* Returns whether the current {@link TemplateVariable} is representing a request parameter.
176
- *
182
+ *
177
183
* @return
178
184
*/
179
185
boolean isRequestParameterVariable () {
@@ -182,14 +188,14 @@ boolean isRequestParameterVariable() {
182
188
183
189
/**
184
190
* Returns whether the variable is a fragment one.
185
- *
191
+ *
186
192
* @return
187
193
*/
188
194
boolean isFragment () {
189
195
return type .equals (FRAGMENT );
190
196
}
191
197
192
- /*
198
+ /*
193
199
* (non-Javadoc)
194
200
* @see java.lang.Object#toString()
195
201
*/
@@ -202,7 +208,7 @@ public String toString() {
202
208
203
209
/**
204
210
* An enumeration for all supported variable types.
205
- *
211
+ *
206
212
* @author Oliver Gierke
207
213
*/
208
214
public enum VariableType {
@@ -227,7 +233,7 @@ public enum VariableType {
227
233
228
234
/**
229
235
* Returns whether the variable of this type is optional.
230
- *
236
+ *
231
237
* @return
232
238
*/
233
239
public boolean isOptional () {
@@ -240,7 +246,7 @@ public boolean canBeCombinedWith(VariableType type) {
240
246
241
247
/**
242
248
* Returns the {@link VariableType} for the given variable key.
243
- *
249
+ *
244
250
* @param key must not be {@literal null}.
245
251
* @return
246
252
*/
0 commit comments