Class TypeSerializer<T>
An abstract class that represents a serializer that can encode and decode to and from a given CQL type and a given CLR Type.
Inherited Members
Namespace: Dse.Serialization
Assembly: Dse.dll
Syntax
public abstract class TypeSerializer<T> : TypeSerializer, ITypeSerializer
Type Parameters
Name | Description |
---|---|
T | CLR type for this serializer |
Properties
CqlType
Returns the Cassandra data type for the serializer.
Declaration
public abstract ColumnTypeCode CqlType { get; }
Property Value
Type | Description |
---|---|
ColumnTypeCode |
Type
Gets the CLR type for this serializer.
Declaration
public Type Type { get; }
Property Value
Type | Description |
---|---|
System.Type |
TypeInfo
Gets the type information for which this serializer is valid.
Intended for non-primitive types such as custom types and UDTs.
For primitive types, it should return null
.
Declaration
public virtual IColumnInfo TypeInfo { get; }
Property Value
Type | Description |
---|---|
IColumnInfo |
Methods
Deserialize(UInt16, Byte[], Int32, Int32, IColumnInfo)
When overridden from a derived class, it reads the byte buffer and returns the CLR representation of the data type.
Declaration
public abstract T Deserialize(ushort protocolVersion, byte[] buffer, int offset, int length, IColumnInfo typeInfo)
Parameters
Type | Name | Description |
---|---|---|
System.UInt16 | protocolVersion | The Cassandra native protocol version. |
System.Byte[] | buffer | The byte array. |
System.Int32 | offset | The zero-based byte offset in buffer at which to begin storing data from the current stream. |
System.Int32 | length | The maximum amount of bytes to read from buffer. |
IColumnInfo | typeInfo | Additional type information designed for non-primitive types. |
Returns
Type | Description |
---|---|
T |
Serialize(UInt16, T)
When overridden from a derived class, it encodes the CLR object into the byte representation according to the Cassandra native protocol.
Declaration
public abstract byte[] Serialize(ushort protocolVersion, T value)
Parameters
Type | Name | Description |
---|---|---|
System.UInt16 | protocolVersion | The Cassandra native protocol version. |
T | value | The object to encode. |
Returns
Type | Description |
---|---|
System.Byte[] |