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.
Inheritance
Inherited Members
Namespace: Cassandra.Serialization
Assembly: Cassandra.dll
Syntax
public abstract class TypeSerializer<T> : TypeSerializer
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 |
---|---|
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(ushort, byte[], int, int, 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 |
---|---|---|
ushort | protocolVersion | The Cassandra native protocol version. |
byte[] | buffer | The byte array. |
int | offset | The zero-based byte offset in buffer at which to begin storing data from the current stream. |
int | 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(ushort, 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 |
---|---|---|
ushort | protocolVersion | The Cassandra native protocol version. |
T | value | The object to encode. |
Returns
Type | Description |
---|---|
byte[] |