org.apache.avro.reflect
Class ReflectDatumWriter

java.lang.Object
  extended by org.apache.avro.generic.GenericDatumWriter<Object>
      extended by org.apache.avro.reflect.ReflectDatumWriter
All Implemented Interfaces:
DatumWriter<Object>
Direct Known Subclasses:
SpecificDatumWriter

public class ReflectDatumWriter
extends GenericDatumWriter<Object>

DatumWriter for existing classes via Java reflection.


Constructor Summary
ReflectDatumWriter()
           
ReflectDatumWriter(Schema root)
           
 
Method Summary
protected  Object getField(Object record, String name, int position)
          Called by the default implementation of GenericDatumWriter.writeRecord(org.apache.avro.Schema, java.lang.Object, org.apache.avro.io.Encoder) to retrieve a record field value.
protected  boolean instanceOf(Schema schema, Object datum)
          Called to resolve unions.
protected  boolean isEnum(Object datum)
          Called by the default implementation of GenericDatumWriter.instanceOf(org.apache.avro.Schema, java.lang.Object).
protected  boolean isRecord(Object datum)
          Called by the default implementation of GenericDatumWriter.instanceOf(org.apache.avro.Schema, java.lang.Object).
protected  void writeEnum(Schema schema, Object datum, Encoder out)
          Called to write an enum value.
 
Methods inherited from class org.apache.avro.generic.GenericDatumWriter
getArrayElements, getArraySize, getMapEntries, getMapSize, isArray, isBytes, isFixed, isMap, isString, setSchema, write, write, writeArray, writeBytes, writeFixed, writeMap, writeRecord, writeString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReflectDatumWriter

public ReflectDatumWriter()

ReflectDatumWriter

public ReflectDatumWriter(Schema root)
Method Detail

getField

protected Object getField(Object record,
                          String name,
                          int position)
Description copied from class: GenericDatumWriter
Called by the default implementation of GenericDatumWriter.writeRecord(org.apache.avro.Schema, java.lang.Object, org.apache.avro.io.Encoder) to retrieve a record field value. The default implementation is for GenericRecord.

Overrides:
getField in class GenericDatumWriter<Object>

writeEnum

protected void writeEnum(Schema schema,
                         Object datum,
                         Encoder out)
                  throws IOException
Description copied from class: GenericDatumWriter
Called to write an enum value. May be overridden for alternate enum representations.

Overrides:
writeEnum in class GenericDatumWriter<Object>
Throws:
IOException

isEnum

protected boolean isEnum(Object datum)
Description copied from class: GenericDatumWriter
Called by the default implementation of GenericDatumWriter.instanceOf(org.apache.avro.Schema, java.lang.Object).

Overrides:
isEnum in class GenericDatumWriter<Object>

isRecord

protected boolean isRecord(Object datum)
Description copied from class: GenericDatumWriter
Called by the default implementation of GenericDatumWriter.instanceOf(org.apache.avro.Schema, java.lang.Object).

Overrides:
isRecord in class GenericDatumWriter<Object>

instanceOf

protected boolean instanceOf(Schema schema,
                             Object datum)
Description copied from class: GenericDatumWriter
Called to resolve unions. May be overridden for alternate data representations.

Overrides:
instanceOf in class GenericDatumWriter<Object>


Copyright © 2009 The Apache Software Foundation