Class ParameterMapper
java.lang.Object
com.eqixiac.equinix.core.http.ParameterMapper
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddAdditionalValue(Map<String, List<String>> queryParameters, String parameterName, APIParam parameterValue) static voidaddAdditionalValue(Map<String, List<String>> queryParameters, String parameterName, String parameterValue) AccumulatesparameterValueunderparameterName, creating the value list on first use and appending (deduplicated) thereafter.concatStringMaps(Map<String, String>... maps) static StringdateTimeForQuery(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').newMap(OptionalRequestBuilder<R> requestBuilder) processRequestBuilder(OptionalRequestBuilder<R> requestBuilder) singleParamList(APIParam parameterValue) singleParamList(Boolean parameterValue) singleParamList(Integer parameterValue) singleParamList(String parameterValue) singleParamMap(String parameterName, APIParam parameterValue) singleParamMap(String parameterName, Boolean parameterValue) singleParamMap(String parameterName, Integer parameterValue) singleParamMap(String parameterName, String parameterValue) singlePropertyBody(String propertyName, Integer propertyValue) singlePropertyBody(String propertyName, String propertyValue)
-
Constructor Details
-
ParameterMapper
public ParameterMapper()
-
-
Method Details
-
newMap
-
addAdditionalValue
-
addAdditionalValue
public static void addAdditionalValue(Map<String, List<String>> queryParameters, String parameterName, String parameterValue) AccumulatesparameterValueunderparameterName, 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 immutableList.of, so accumulating a second distinct value for the same key threwUnsupportedOperationException. Anullvalue is a no-op (optional parameters are simply omitted). -
singlePropertyBody
-
singlePropertyBody
-
concatStringMaps
-
singleParamList
-
singleParamList
-
singleParamList
-
singleParamList
-
singleParamMap
-
singleParamMap
-
singleParamMap
-
singleParamMap
-
processRequestBuilder
public static <R> Map<String, List<String>> processRequestBuilder(OptionalRequestBuilder<R> requestBuilder) -
dateTimeForQuery
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:
LocalDateTimeinputs are UTC wall clock. This matches every timestamp the SDK returns - the core deserializer parses"...T12:00:00Z"into a bareLocalDateTimeof 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", useLocalDateTime.now(ZoneOffset.UTC)- never zone-localLocalDateTime.now().- Parameters:
localDateTime- the date-time, as UTC wall clock- Returns:
- the wire representation, the input digits with a literal
'Z'appended
-