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

Method join

core/src/main/java/feign/CollectionFormat.java:64–89  ·  view source on GitHub ↗

Joins the field and possibly multiple values with the given separator. Calling EXPLODED.join("foo", ["bar"]) will return "foo=bar". Calling CSV.join("foo", ["bar", "baz"]) will return "foo=bar,baz". Null values are treated somewhat specially. With EXPLODED, the field is repeated without

(String field, Collection<String> values, Charset charset)

Source from the content-addressed store, hash-verified

62 * empty, an empty char sequence will be returned.
63 */
64 public CharSequence join(String field, Collection<String> values, Charset charset) {
65 StringBuilder builder = new StringBuilder();
66 int valueCount = 0;
67 for (String value : values) {
68 if (separator == null) {
69 // exploded
70 builder.append(valueCount++ == 0 ? "" : "&");
71 builder.append(UriUtils.encode(field, charset));
72 if (value != null) {
73 builder.append('=');
74 builder.append(value);
75 }
76 } else {
77 // delimited with a separator character
78 if (builder.length() == 0) {
79 builder.append(UriUtils.encode(field, charset));
80 }
81 if (value == null) {
82 continue;
83 }
84 builder.append(valueCount++ == 0 ? "=" : UriUtils.encode(separator, charset));
85 builder.append(value);
86 }
87 }
88 return builder;
89 }
90}

Callers 15

canonicalizeMethod · 0.80
describeFieldsMethod · 0.80
formatFieldParamMethod · 0.80
cancelRetryMethod · 0.80
invokeMethod · 0.80
convertAndSendMethod · 0.80
queryStringMethod · 0.80
expandMethod · 0.80

Calls 3

encodeMethod · 0.95
lengthMethod · 0.65
appendMethod · 0.45