me.prettyprint.hector.api
Interface Serializer<T>

Type Parameters:
T - The type to which data extraction should work.
All Known Implementing Classes:
AbstractSerializer, AsciiSerializer, BigIntegerSerializer, BooleanSerializer, ByteBufferSerializer, BytesArraySerializer, CharSerializer, CompositeSerializer, DateSerializer, DoubleSerializer, DynamicCompositeSerializer, FastInfosetSerializer, FloatSerializer, IntegerSerializer, JaxbSerializer, LongSerializer, ObjectSerializer, PrefixedSerializer, ShortSerializer, StringSerializer, TimeUUIDSerializer, TypeInferringSerializer, UUIDSerializer

public interface Serializer<T>

Serializes a type T from the given bytes, or vice a versa. In cassandra column names and column values (and starting with 0.7.0 row keys) are all byte[]. To allow type safe conversion in java and keep all conversion code in one place we define the Extractor interface. Implementors of the interface define type conversion according to their domains. A predefined set of common extractors can be found in the extractors package, for example StringSerializer.

Author:
Ran Tavory

Method Summary
 T fromByteBuffer(ByteBuffer byteBuffer)
          Extract an object of type T from the bytes.
 T fromBytes(byte[] bytes)
           
 List<T> fromBytesList(List<ByteBuffer> list)
           
<V> Map<T,V>
fromBytesMap(Map<ByteBuffer,V> map)
           
 List<T> fromBytesSet(Set<ByteBuffer> list)
           
 ComparatorType getComparatorType()
           
 ByteBuffer toByteBuffer(T obj)
          Extract bytes from the obj of type T
 byte[] toBytes(T obj)
           
 List<ByteBuffer> toBytesList(List<T> list)
           
<V> Map<ByteBuffer,V>
toBytesMap(Map<T,V> map)
           
 Set<ByteBuffer> toBytesSet(List<T> list)
           
 

Method Detail

toByteBuffer

ByteBuffer toByteBuffer(T obj)
Extract bytes from the obj of type T

Parameters:
obj -
Returns:

toBytes

byte[] toBytes(T obj)

fromBytes

T fromBytes(byte[] bytes)

fromByteBuffer

T fromByteBuffer(ByteBuffer byteBuffer)
Extract an object of type T from the bytes.

Parameters:
bytes -
Returns:

toBytesSet

Set<ByteBuffer> toBytesSet(List<T> list)

fromBytesSet

List<T> fromBytesSet(Set<ByteBuffer> list)

toBytesMap

<V> Map<ByteBuffer,V> toBytesMap(Map<T,V> map)

fromBytesMap

<V> Map<T,V> fromBytesMap(Map<ByteBuffer,V> map)

toBytesList

List<ByteBuffer> toBytesList(List<T> list)

fromBytesList

List<T> fromBytesList(List<ByteBuffer> list)

getComparatorType

ComparatorType getComparatorType()


Copyright © 2011. All Rights Reserved.