public enum CollectionFormat extends Enum<CollectionFormat>
These specific cases are inspired by the OpenAPI specification.
Enum Constant and Description |
---|
CSV
Comma separated values, eg foo=bar,baz
|
EXPLODED
Parameter name repeated for each value, eg foo=bar&foo=baz
|
PIPES
Values separated with the pipe (|) character, eg foo=bar|baz
|
SSV
Space separated values, eg foo=bar baz
|
TSV
Tab separated values, eg foo=bar[tab]baz
|
Modifier and Type | Method and Description |
---|---|
CharSequence |
join(String field,
Collection<String> values,
Charset charset)
Joins the field and possibly multiple values with the given separator.
|
static CollectionFormat |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static CollectionFormat[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final CollectionFormat CSV
public static final CollectionFormat SSV
public static final CollectionFormat TSV
public static final CollectionFormat PIPES
public static final CollectionFormat EXPLODED
public static CollectionFormat[] values()
for (CollectionFormat c : CollectionFormat.values()) System.out.println(c);
public static CollectionFormat valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic CharSequence join(String field, Collection<String> values, Charset charset)
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 any "=" for backwards compatibility. With all other formats, null values are not included in the joined value list.
field
- The field name corresponding to these values.values
- A collection of value strings for the given field.charset
- to encode the sequenceCopyright © 2012–2021 OpenFeign. All rights reserved.