com.netflix.astyanax
Interface Serializer<T>

Type Parameters:
T - The type to which data extraction should work.
All Known Implementing Classes:
AbstractSerializer, AnnotatedCompositeSerializer, AsciiSerializer, BigDecimalSerializer, BigIntegerSerializer, BooleanSerializer, ByteBufferSerializer, BytesArraySerializer, ByteSerializer, CharSerializer, CompositeSerializer, DateSerializer, DoubleSerializer, DynamicCompositeSerializer, FloatSerializer, GzipStringSerializer, Int32Serializer, IntegerSerializer, JaxbSerializer, ListSerializer, LongSerializer, MapSerializer, ObjectSerializer, PrefixedSerializer, SetSerializer, ShortSerializer, SnappyStringSerializer, SpecificCompositeSerializer, 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.


Method Summary
 T fromByteBuffer(java.nio.ByteBuffer byteBuffer)
          Extract an object of type T from the bytes.
 T fromBytes(byte[] bytes)
           
 java.util.List<T> fromBytesList(java.util.List<java.nio.ByteBuffer> list)
           
<V> java.util.Map<T,V>
fromBytesMap(java.util.Map<java.nio.ByteBuffer,V> map)
           
 java.util.List<T> fromBytesSet(java.util.Set<java.nio.ByteBuffer> list)
           
 java.nio.ByteBuffer fromString(java.lang.String string)
          Create a ByteBuffer by first parsing the type out of a string
 ComparatorType getComparatorType()
           
 java.nio.ByteBuffer getNext(java.nio.ByteBuffer byteBuffer)
          Return the byte buffer for the next value in sorted order for the matching comparator type.
 java.lang.String getString(java.nio.ByteBuffer byteBuffer)
           
 java.nio.ByteBuffer toByteBuffer(T obj)
          Extract bytes from the obj of type T
 byte[] toBytes(T obj)
           
 java.util.List<java.nio.ByteBuffer> toBytesList(java.util.Collection<T> list)
           
 java.util.List<java.nio.ByteBuffer> toBytesList(java.lang.Iterable<T> list)
           
 java.util.List<java.nio.ByteBuffer> toBytesList(java.util.List<T> list)
           
<V> java.util.Map<java.nio.ByteBuffer,V>
toBytesMap(java.util.Map<T,V> map)
           
 java.util.Set<java.nio.ByteBuffer> toBytesSet(java.util.List<T> list)
           
 

Method Detail

toByteBuffer

java.nio.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(java.nio.ByteBuffer byteBuffer)
Extract an object of type T from the bytes.

Parameters:
bytes -
Returns:

toBytesSet

java.util.Set<java.nio.ByteBuffer> toBytesSet(java.util.List<T> list)

fromBytesSet

java.util.List<T> fromBytesSet(java.util.Set<java.nio.ByteBuffer> list)

toBytesMap

<V> java.util.Map<java.nio.ByteBuffer,V> toBytesMap(java.util.Map<T,V> map)

fromBytesMap

<V> java.util.Map<T,V> fromBytesMap(java.util.Map<java.nio.ByteBuffer,V> map)

toBytesList

java.util.List<java.nio.ByteBuffer> toBytesList(java.util.List<T> list)

toBytesList

java.util.List<java.nio.ByteBuffer> toBytesList(java.util.Collection<T> list)

toBytesList

java.util.List<java.nio.ByteBuffer> toBytesList(java.lang.Iterable<T> list)

fromBytesList

java.util.List<T> fromBytesList(java.util.List<java.nio.ByteBuffer> list)

getComparatorType

ComparatorType getComparatorType()

getNext

java.nio.ByteBuffer getNext(java.nio.ByteBuffer byteBuffer)
Return the byte buffer for the next value in sorted order for the matching comparator type. This is used for paginating columns.

Parameters:
byteBuffer -
Returns:

fromString

java.nio.ByteBuffer fromString(java.lang.String string)
Create a ByteBuffer by first parsing the type out of a string

Parameters:
string -
Returns:

getString

java.lang.String getString(java.nio.ByteBuffer byteBuffer)