Class Formatter
- java.lang.Object
-
- de.xima.fc.api.rest.pub.client.security.Formatter
-
@Generated("de.xima.openapi.codegen.java_jaxrs.XimaJavaJaxrsGenerator") public final class Formatter extends ObjectHelper methods for web related tasks such as URL encoding etc.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringescapeString(Object str)Converts the given object to a string and escapes it so it can be used as URL query value.StringescapeString(String str)Escape the given string to be used as URL query value.List<Pair>parameterToPairs(String collectionFormat, String name, Object value)Format toPairobjects.StringparameterToString(Object param)Format the given parameter object into string.DateparseDate(String str)Parse the given string into Date object.OffsetDateTimeparseOffsetDateTime(String str)Parse the given string intoOffsetDateTimeobject.StringselectHeaderContentType(String[] contentTypes)Select the Content-Type header's value from the given array: if JSON exists in the given array, use it; otherwise use the first one of the array.
-
-
-
Method Detail
-
parameterToString
public String parameterToString(Object param)
Format the given parameter object into string.- Parameters:
param- an object to format- Returns:
- the
Stringversion of the object
-
parameterToPairs
public List<Pair> parameterToPairs(String collectionFormat, String name, Object value)
Format toPairobjects.- Parameters:
collectionFormat- Either csv (comma separated), tsv (tab separated), or pipes (separated by a pipe character).name- Name of the pair.value- One or more values of the pair. Can be a string or a Collection.- Returns:
- The pair formatted according to the given format, e.g. a string with the name and value separated by the given delimiter, and each pair separated from each other by a comma.
-
escapeString
public String escapeString(String str)
Escape the given string to be used as URL query value.- Parameters:
str- aStringto escape- Returns:
- the escaped version of the
String
-
escapeString
public String escapeString(Object str)
Converts the given object to a string and escapes it so it can be used as URL query value. When null is given, an empty string is returned.- Parameters:
str- aStringto escape- Returns:
- the escaped version of the
String
-
selectHeaderContentType
public String selectHeaderContentType(String[] contentTypes)
Select the Content-Type header's value from the given array: if JSON exists in the given array, use it; otherwise use the first one of the array.- Parameters:
contentTypes- The Content-Type array to select from- Returns:
- The Content-Type header to use. If the given array is empty, JSON will be used.
-
parseDate
public Date parseDate(String str)
Parse the given string into Date object.- Parameters:
str- a string to parse- Returns:
- a
Dateobject
-
parseOffsetDateTime
public OffsetDateTime parseOffsetDateTime(String str)
Parse the given string intoOffsetDateTimeobject.- Parameters:
str- String- Returns:
OffsetDateTime
-
-