Package kong.unirest.modules.gson
Class GsonObjectMapper
java.lang.Object
kong.unirest.modules.gson.GsonObjectMapper
- All Implemented Interfaces:
ObjectMapper
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classprivate static classprivate static classprivate static classprivate static classprivate static class -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate com.google.gson.GsongetGson()<T> Treads the content from the request as a string and transforms to a type passed by the asObject method on the Unirest builder.<T> TreadValue(String value, GenericType<T> genericType) reads the content from the request as a string and transforms to a type passed by the asObject method on the Unirest builder.writeValue(Object value) Takes a object and serialize it as a string.
-
Field Details
-
ISO_8601
- See Also:
-
gson
private com.google.gson.Gson gson
-
-
Constructor Details
-
GsonObjectMapper
public GsonObjectMapper() -
GsonObjectMapper
public GsonObjectMapper(com.google.gson.Gson gson)
-
-
Method Details
-
readValue
Description copied from interface:ObjectMapperreads the content from the request as a string and transforms to a type passed by the asObject method on the Unirest builder.- Specified by:
readValuein interfaceObjectMapper- Type Parameters:
T- the type- Parameters:
value- the content as a string.valueType- the type to map to- Returns:
- the object mapped into the class type
-
readValue
Description copied from interface:ObjectMapperreads the content from the request as a string and transforms to a type passed by the asObject method on the Unirest builder. This method takes a GenericType which retains Generics information for types lke List<Foo>- Specified by:
readValuein interfaceObjectMapper- Type Parameters:
T- the type- Parameters:
value- the content as a string.genericType- the generic type- Returns:
- the object mapped into the class type
-
writeValue
Description copied from interface:ObjectMapperTakes a object and serialize it as a string. This is used to map objects to bodies to pass to requests- Specified by:
writeValuein interfaceObjectMapper- Parameters:
value- the object to serialize to a string- Returns:
- the serialized string of the object
-
getGson
private com.google.gson.Gson getGson()
-