Package com.microsoft.rest.protocol
Interface SerializerAdapter<T>
-
- Type Parameters:
T- the original serializer
- All Known Implementing Classes:
JacksonAdapter
public interface SerializerAdapter<T>This interface defines the behaviors an adapter of a serializer needs to implement.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description retrofit2.Converter.FactoryconverterFactory()<U> Udeserialize(String value, Type type)Deserializes a string into aSerializerAdapterobject using the currentSerializerAdapter.Stringserialize(Object object)Serializes an object into a JSON string.StringserializeList(List<?> list, CollectionFormat format)Serializes a list into a string with the delimiter specified with the Swagger collection format joining each individual serialized items in the list.Tserializer()StringserializeRaw(Object object)Serializes an object into a raw string.
-
-
-
Method Detail
-
serializer
T serializer()
- Returns:
- the adapted original serializer
-
converterFactory
retrofit2.Converter.Factory converterFactory()
- Returns:
- a converter factory for Retrofit
-
serialize
String serialize(Object object) throws IOException
Serializes an object into a JSON string.- Parameters:
object- the object to serialize.- Returns:
- the serialized string. Null if the object to serialize is null.
- Throws:
IOException- exception from serialization.
-
serializeRaw
String serializeRaw(Object object)
Serializes an object into a raw string. The leading and trailing quotes will be trimmed.- Parameters:
object- the object to serialize.- Returns:
- the serialized string. Null if the object to serialize is null.
-
serializeList
String serializeList(List<?> list, CollectionFormat format)
Serializes a list into a string with the delimiter specified with the Swagger collection format joining each individual serialized items in the list.- Parameters:
list- the list to serialize.format- the Swagger collection format.- Returns:
- the serialized string
-
deserialize
<U> U deserialize(String value, Type type) throws IOException
Deserializes a string into aSerializerAdapterobject using the currentSerializerAdapter.- Type Parameters:
U- the type of the deserialized object.- Parameters:
value- the string value to deserialize.type- the type to deserialize.- Returns:
- the deserialized object.
- Throws:
IOException- exception in deserialization
-
-