public abstract class SimpleTypeSerializer<T> extends Object implements TypeSerializer<T>
Constructor and Description |
---|
SimpleTypeSerializer(DataType dataType) |
Modifier and Type | Method and Description |
---|---|
DataType |
getDataType()
Gets the
DataType that is represented by the given T . |
T |
read(ByteBuf buffer,
GraphBinaryReader context)
Reads the type information and value from the buffer and returns an instance of T.
|
T |
readValue(ByteBuf buffer,
GraphBinaryReader context,
boolean nullable)
Reads the value from the buffer (not the type information) and returns an instance of T.
|
ByteBuf |
write(T value,
ByteBufAllocator allocator,
GraphBinaryWriter context)
Writes the type code, information and value to a buffer using the provided allocator.
|
abstract ByteBuf |
writeValue(T value,
ByteBufAllocator allocator,
GraphBinaryWriter context)
Writes a non-nullable value into a buffer using the provided allocator.
|
ByteBuf |
writeValue(T value,
ByteBufAllocator allocator,
GraphBinaryWriter context,
boolean nullable)
Writes the value to a buffer, composed by the value flag and the sequence of bytes.
|
public SimpleTypeSerializer(DataType dataType)
public DataType getDataType()
TypeSerializer
DataType
that is represented by the given T
.getDataType
in interface TypeSerializer<T>
public T read(ByteBuf buffer, GraphBinaryReader context) throws SerializationException
TypeSerializer
read
in interface TypeSerializer<T>
SerializationException
public T readValue(ByteBuf buffer, GraphBinaryReader context, boolean nullable) throws SerializationException
TypeSerializer
Implementors should throw an exception when a complex type doesn't support reading without the type information.
readValue
in interface TypeSerializer<T>
SerializationException
public ByteBuf write(T value, ByteBufAllocator allocator, GraphBinaryWriter context) throws SerializationException
TypeSerializer
write
in interface TypeSerializer<T>
SerializationException
public ByteBuf writeValue(T value, ByteBufAllocator allocator, GraphBinaryWriter context, boolean nullable) throws SerializationException
TypeSerializer
writeValue
in interface TypeSerializer<T>
SerializationException
public abstract ByteBuf writeValue(T value, ByteBufAllocator allocator, GraphBinaryWriter context) throws SerializationException
value
- A non-nullable value.allocator
- The buffer allocator to use.context
- The binary writer.SerializationException
Copyright © 2013–2019 Apache Software Foundation. All rights reserved.