Package kong.unirest.core
Interface ObjectMapper
-
public interface ObjectMapper
Interface for object mappers that can transform response bodies to other structures.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description <T> T
readValue(String value, Class<T> valueType)
reads the content from the request as a string and transforms to a type passed by the asObject method on the Unirest builder.default <T> T
readValue(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.String
writeValue(Object value)
Takes a object and serialize it as a string.
-
-
-
Method Detail
-
readValue
<T> T readValue(String value, Class<T> valueType)
reads the content from the request as a string and transforms to a type passed by the asObject method on the Unirest builder.- 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
default <T> T readValue(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. This method takes a GenericType which retains Generics information for types lke List<Foo>- Type Parameters:
T
- the type- Parameters:
value
- the content as a string.genericType
- the generic type- Returns:
- the object mapped into the class type
-
-