Class ParameterMapper

java.lang.Object
com.eqixiac.equinix.core.http.ParameterMapper

public final class ParameterMapper extends Object
Builds query-parameter maps and single-value parameter lists for request construction, and formats query-string values (e.g. UTC timestamps).

Split out of the former monolithic Utils class; see RequestAssembler, ResponseHandler and SerializationHelper for the other request/response helpers.

Author:
ianjones
  • Constructor Details

    • ParameterMapper

      public ParameterMapper()
  • Method Details

    • newMap

      public static <R> Map<String, List<String>> newMap(OptionalRequestBuilder<R> requestBuilder)
    • addAdditionalValue

      public static void addAdditionalValue(Map<String, List<String>> queryParameters, String parameterName, APIParam parameterValue)
    • addAdditionalValue

      public static void addAdditionalValue(Map<String, List<String>> queryParameters, String parameterName, String parameterValue)
      Accumulates parameterValue under parameterName, creating the value list on first use and appending (deduplicated) thereafter. The stored list is always mutable - the previous implementation seeded new keys with an immutable List.of, so accumulating a second distinct value for the same key threw UnsupportedOperationException. A null value is a no-op (optional parameters are simply omitted).
    • singlePropertyBody

      public static Map<String,Integer> singlePropertyBody(String propertyName, Integer propertyValue)
    • singlePropertyBody

      public static Map<String,String> singlePropertyBody(String propertyName, String propertyValue)
    • concatStringMaps

      @SafeVarargs public static Map<String,String> concatStringMaps(Map<String,String>... maps)
    • singleParamList

      public static List<String> singleParamList(String parameterValue)
    • singleParamList

      public static List<String> singleParamList(Boolean parameterValue)
    • singleParamList

      public static List<String> singleParamList(Integer parameterValue)
    • singleParamList

      public static List<String> singleParamList(APIParam parameterValue)
    • singleParamMap

      public static Map<String, List<String>> singleParamMap(String parameterName, String parameterValue)
    • singleParamMap

      public static Map<String, List<String>> singleParamMap(String parameterName, APIParam parameterValue)
    • singleParamMap

      public static Map<String, List<String>> singleParamMap(String parameterName, Boolean parameterValue)
    • singleParamMap

      public static Map<String, List<String>> singleParamMap(String parameterName, Integer parameterValue)
    • processRequestBuilder

      public static <R> Map<String, List<String>> processRequestBuilder(OptionalRequestBuilder<R> requestBuilder)
    • dateTimeForQuery

      public static String dateTimeForQuery(LocalDateTime localDateTime)
      Formats a date-time for a query parameter in the API's UTC wire format (yyyy-MM-dd'T'HH:mm:ss'Z').

      UTC contract: LocalDateTime inputs are UTC wall clock. This matches every timestamp the SDK returns - the core deserializer parses "...T12:00:00Z" into a bare LocalDateTime of 12:00, so any API-sourced value (e.g. changeLog.getCreatedDateTime()) can be passed straight back here and round-trips unchanged. The digits are formatted verbatim with a literal 'Z'; no zone conversion is performed. For "now", use LocalDateTime.now(ZoneOffset.UTC) - never zone-local LocalDateTime.now().

      Parameters:
      localDateTime - the date-time, as UTC wall clock
      Returns:
      the wire representation, the input digits with a literal 'Z' appended