Class EncodingUtils

java.lang.Object
io.iworkflow.gen.api.EncodingUtils

public final class EncodingUtils extends Object
Utilities to support Swagger encoding formats in Feign.
  • Method Details

    • encodeCollection

      public static Object encodeCollection(Collection<?> parameters, 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 String encode(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.