Package io.iworkflow.gen.api
Class EncodingUtils
- java.lang.Object
-
- io.iworkflow.gen.api.EncodingUtils
-
public final class EncodingUtils extends java.lang.Object
Utilities to support Swagger encoding formats in Feign.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
encode(java.lang.Object parameter)
URL encode a single query parameter.static java.lang.Object
encodeCollection(java.util.Collection<?> parameters, java.lang.String collectionFormat)
Encodes a collection of query parameters according to the Swagger collection format.
-
-
-
Method Detail
-
encodeCollection
public static java.lang.Object encodeCollection(java.util.Collection<?> parameters, java.lang.String collectionFormat)
Encodes a collection of query parameters according to the Swagger collection format.
Of the various collection formats defined by Swagger ("csv", "tsv", etc), Feign only natively supports "multi". This utility generates the other format types so it will be properly processed by Feign.
Note, as part of reformatting, it URL encodes the parameters as well.
- Parameters:
parameters
- The collection object to be formatted. This object will not be changed.collectionFormat
- The Swagger collection format (eg, "csv", "tsv", "pipes"). See the OpenAPI Spec for more details.- Returns:
- An object that will be correctly formatted by Feign.
-
encode
public static java.lang.String encode(java.lang.Object parameter)
URL encode a single query parameter.- Parameters:
parameter
- The query parameter to encode. This object will not be changed.- Returns:
- The URL encoded string representation of the parameter. If the parameter is null, returns null.
-
-