Package io.servicetalk.serialization.api
Interface SerializationProvider
-
- All Known Implementing Classes:
JacksonSerializationProvider
,ProtobufSerializationProvider
public interface SerializationProvider
A provider of serialization implementation forSerializer
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description <T> StreamingDeserializer<T>
getDeserializer(TypeHolder<T> typeToDeserialize)
Provide aStreamingDeserializer
instance that can deserialize instances ofSerializationProvider
.<T> StreamingDeserializer<T>
getDeserializer(java.lang.Class<T> classToDeSerialize)
Provide aStreamingDeserializer
instance that can deserialize instances ofSerializationProvider
.<T> StreamingSerializer
getSerializer(TypeHolder<T> typeToSerialize)
Provide aStreamingSerializer
instance that can serialize instances ofSerializationProvider
.<T> StreamingSerializer
getSerializer(java.lang.Class<T> classToSerialize)
Provide aStreamingSerializer
instance that can serialize instances ofSerializationProvider
.default <T> void
serialize(T toSerialize, Buffer destination)
Serializes the passed objecttoSerialize
to the passedBuffer
.
-
-
-
Method Detail
-
getSerializer
<T> StreamingSerializer getSerializer(java.lang.Class<T> classToSerialize)
Provide aStreamingSerializer
instance that can serialize instances ofSerializationProvider
.- Type Parameters:
T
- The data type to serialize.- Parameters:
classToSerialize
- The class forSerializationProvider
, the object to be serialized.- Returns:
- An instance of
StreamingSerializer
that can serialize instances ofSerializationProvider
.
-
getSerializer
<T> StreamingSerializer getSerializer(TypeHolder<T> typeToSerialize)
Provide aStreamingSerializer
instance that can serialize instances ofSerializationProvider
.- Type Parameters:
T
- The data type to serialize.- Parameters:
typeToSerialize
-TypeHolder
holding theParameterizedType
to be serialized.- Returns:
- An instance of
StreamingSerializer
that can serialize instances ofSerializationProvider
.
-
serialize
default <T> void serialize(T toSerialize, Buffer destination)
Serializes the passed objecttoSerialize
to the passedBuffer
.- Type Parameters:
T
- The data type to serialize.- Parameters:
toSerialize
- Object to serialize.destination
- TheBuffer
to which the serialized representation oftoSerialize
is written.
-
getDeserializer
<T> StreamingDeserializer<T> getDeserializer(java.lang.Class<T> classToDeSerialize)
Provide aStreamingDeserializer
instance that can deserialize instances ofSerializationProvider
.- Type Parameters:
T
- The data type to deserialize.- Parameters:
classToDeSerialize
- The class forSerializationProvider
, the object to be deserialized.- Returns:
- An instance of
StreamingDeserializer
that can deserialize instances ofSerializationProvider
.
-
getDeserializer
<T> StreamingDeserializer<T> getDeserializer(TypeHolder<T> typeToDeserialize)
Provide aStreamingDeserializer
instance that can deserialize instances ofSerializationProvider
.- Type Parameters:
T
- The data type to deserialize.- Parameters:
typeToDeserialize
-TypeHolder
holding theParameterizedType
to be deserialized.- Returns:
- An instance of
StreamingDeserializer
that can deserialize instances ofSerializationProvider
.
-
-