T
- The type that this adapter can convertpublic class GuardedSerializationTypeAdapter<T> extends TypeAdapter<T>
This implementation is useful for wrapping other TypeAdapter instances and ensuring that the objects supplied to the adapter will be serialized to a single value.
Constructor and Description |
---|
GuardedSerializationTypeAdapter(TypeAdapter<T> delegate)
Construct a new GuardedSerializationTypeAdapter instance
|
Modifier and Type | Method and Description |
---|---|
T |
deserialize(ProtocolReader reader)
Deserializes binary data from a ProtocolReader to a concrete java data type
|
void |
serialize(ProtocolWriter writer,
T value)
Serializes data from an object and writes it to a ProtocolWriter
|
public GuardedSerializationTypeAdapter(TypeAdapter<T> delegate)
delegate
- a non-null TypeAdapter to be guarded.java.lang.IllegalArgumentException
- on a null TypeAdapter argument.public T deserialize(ProtocolReader reader) throws java.io.IOException
TypeAdapter
deserialize
in class TypeAdapter<T>
reader
- A ProtocolReader to read the datajava.io.IOException
- on failed IO operationspublic void serialize(ProtocolWriter writer, T value) throws java.io.IOException
TypeAdapter
serialize
in class TypeAdapter<T>
writer
- A ProtocolWriter to write the datavalue
- A concrete java implementation of the data type to be serializedjava.io.IOException
- on failed IO operations