voldemort.serialization.avro
Class AvroReflectiveSerializer<T>

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

public class AvroReflectiveSerializer<T>
extends java.lang.Object
implements Serializer<T>

Avro serializer that uses Java reflection to generate schemas and protocols for existing classes.

This API is not recommended except as a stepping stone for systems that currently uses Java interfaces to define RPC protocols. For new RPC systems, the Avro specific API is preferred. For systems that process dynamic data, the Avro generic API is probably best.

Reflection is supported from either the class, the schema or both. For now we only support the class case.


Constructor Summary
AvroReflectiveSerializer(java.lang.String schemaInfo)
          Constructor accepting a Java class name under the convention java=classname.
 
Method Summary
 byte[] toBytes(T object)
          Construct an array of bytes from the given object
 T 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

AvroReflectiveSerializer

public AvroReflectiveSerializer(java.lang.String schemaInfo)
Constructor accepting a Java class name under the convention java=classname.

Parameters:
schemaInfo - information on the schema for the serializer
Method Detail

toBytes

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

Specified by:
toBytes in interface Serializer<T>
Parameters:
object - The object
Returns:
The bytes taken from the object

toObject

public T toObject(byte[] bytes)
Description copied from interface: Serializer
Create an object from an array of bytes

Specified by:
toObject in interface Serializer<T>
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