@@ -71,6 +71,66 @@ public TemplateVariable(String name, TemplateVariable.VariableType type, String
71
71
this .description = description ;
72
72
}
73
73
74
+ /**
75
+ * Static helper to fashion {@link VariableType#PATH_VARIABLE} variables.
76
+ *
77
+ * @param pathVariable
78
+ * @return
79
+ */
80
+ public static TemplateVariable pathVariable (String pathVariable ) {
81
+ return new TemplateVariable (pathVariable , VariableType .PATH_VARIABLE );
82
+ }
83
+
84
+ /**
85
+ * Static helper to fashion {@link VariableType#REQUEST_PARAM} variables.
86
+ *
87
+ * @param requestParam
88
+ * @return
89
+ */
90
+ public static TemplateVariable requestParam (String requestParam ) {
91
+ return new TemplateVariable (requestParam , VariableType .REQUEST_PARAM );
92
+ }
93
+
94
+ /**
95
+ * Static helper to fashion {@link VariableType#REQUEST_PARAM_CONTINUED} variables.
96
+ *
97
+ * @param requestParam
98
+ * @return
99
+ */
100
+ public static TemplateVariable requestParamContinued (String requestParam ) {
101
+ return new TemplateVariable (requestParam , VariableType .REQUEST_PARAM_CONTINUED );
102
+ }
103
+
104
+ /**
105
+ * Static helper to fashion {@link VariableType#SEGMENT} variables.
106
+ *
107
+ * @param segment
108
+ * @return
109
+ */
110
+ public static TemplateVariable segment (String segment ) {
111
+ return new TemplateVariable (segment , VariableType .SEGMENT );
112
+ }
113
+
114
+ /**
115
+ * Static helper to fashion {@link VariableType#FRAGMENT} variables.
116
+ *
117
+ * @param fragment
118
+ * @return
119
+ */
120
+ public static TemplateVariable fragment (String fragment ) {
121
+ return new TemplateVariable (fragment , VariableType .FRAGMENT );
122
+ }
123
+
124
+ /**
125
+ * Static helper to fashion {@link VariableType#COMPOSITE_PARAM} variables.
126
+ *
127
+ * @param compositeParam
128
+ * @return
129
+ */
130
+ public static TemplateVariable compositeParam (String compositeParam ) {
131
+ return new TemplateVariable (compositeParam , VariableType .COMPOSITE_PARAM );
132
+ }
133
+
74
134
/**
75
135
* Returns whether the variable has a description.
76
136
*
@@ -192,7 +252,7 @@ public static TemplateVariable.VariableType from(String key) {
192
252
.orElseThrow (() -> new IllegalArgumentException ("Unsupported variable type " + key + "!" ));
193
253
}
194
254
195
- /*
255
+ /*
196
256
* (non-Javadoc)
197
257
* @see java.lang.Enum#toString()
198
258
*/
0 commit comments