voldemort.serialization.avro.versioned
Class AvroVersionedGenericSerializer

java.lang.Object
  extended by voldemort.serialization.avro.versioned.AvroVersionedGenericSerializer
All Implemented Interfaces:
Serializer<java.lang.Object>

public class AvroVersionedGenericSerializer
extends java.lang.Object
implements Serializer<java.lang.Object>

Avro serializer that uses the generic representation for Avro data. This representation is best for applications which deal with dynamic data, whose schemas are not known until runtime. This serializer supports schema versioning


Constructor Summary
AvroVersionedGenericSerializer(java.util.Map<java.lang.Integer,java.lang.String> typeDefVersions)
           
AvroVersionedGenericSerializer(java.lang.String schema)
          Constructor accepting the schema definition as a JSON string.
 
Method Summary
 byte[] toBytes(java.lang.Object object)
          Construct an array of bytes from the given object
 java.lang.Object toObject(byte[] bytes)
          Create an object from an array of bytes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AvroVersionedGenericSerializer

public AvroVersionedGenericSerializer(java.lang.String schema)
Constructor accepting the schema definition as a JSON string.

Parameters:
schema - a serialized JSON object representing a Avro schema.

AvroVersionedGenericSerializer

public AvroVersionedGenericSerializer(java.util.Map<java.lang.Integer,java.lang.String> typeDefVersions)
Method Detail

toBytes

public byte[] toBytes(java.lang.Object object)
Description copied from interface: Serializer
Construct an array of bytes from the given object

Specified by:
toBytes in interface Serializer<java.lang.Object>
Parameters:
object - The object
Returns:
The bytes taken from the object

toObject

public java.lang.Object toObject(byte[] bytes)
Description copied from interface: Serializer
Create an object from an array of bytes

Specified by:
toObject in interface Serializer<java.lang.Object>
Parameters:
bytes - An array of bytes with the objects data
Returns:
A java object serialzed from the bytes


Jay Kreps, Roshan Sumbaly, Alex Feinberg, Bhupesh Bansal, Lei Gao, Chinmay Soman, Vinoth Chandar, Zhongjie Wu