MCPcopy Index your code
hub / github.com/OpenFeign/feign / expand

Method expand

core/src/main/java/feign/template/QueryTemplate.java:188–215  ·  view source on GitHub ↗

Expand this template. Unresolved variables are removed. If all values remain unresolved, the result is an empty string. @param variables containing the values for expansion. @return the expanded template.

(Map<String, ?> variables)

Source from the content-addressed store, hash-verified

186 * @return the expanded template.
187 */
188 public String expand(Map<String, ?> variables) {
189 String name = this.name.expand(variables);
190
191 if (this.pure) {
192 return name;
193 }
194
195 List<String> expanded = new ArrayList<>();
196 for (Template template : this.values) {
197 String result = template.expand(variables);
198 if (result == null) {
199 continue;
200 }
201
202 /*
203 * check for an iterable result, and if one is there, we need to split it into individual
204 * values
205 */
206 if (result.contains(",")) {
207 /* we need to split it */
208 expanded.addAll(Arrays.asList(result.split(",")));
209 } else {
210 expanded.add(result);
211 }
212 }
213
214 return this.queryString(name, Collections.unmodifiableList(expanded));
215 }
216
217 private String queryString(String name, List<String> values) {
218 if (this.pure) {

Callers 15

expandEmptyCollectionMethod · 0.95
expandCollectionMethod · 0.95
expandSingleValueMethod · 0.95
expandMultipleValuesMethod · 0.95
unresolvedQueryMethod · 0.95
emptyParameterRemainsMethod · 0.95
collectionFormatMethod · 0.95
expandNameMethod · 0.95
expandPureParameterMethod · 0.95

Calls 4

queryStringMethod · 0.95
expandMethod · 0.65
asListMethod · 0.45
addMethod · 0.45

Tested by 15

expandEmptyCollectionMethod · 0.76
expandCollectionMethod · 0.76
expandSingleValueMethod · 0.76
expandMultipleValuesMethod · 0.76
unresolvedQueryMethod · 0.76
emptyParameterRemainsMethod · 0.76
collectionFormatMethod · 0.76
expandNameMethod · 0.76
expandPureParameterMethod · 0.76