org.apache.avro.specific
Class SpecificDatumWriter<T>

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

public class SpecificDatumWriter<T>
extends GenericDatumWriter<T>

DatumWriter for generated Java classes.


Constructor Summary
  SpecificDatumWriter()
           
  SpecificDatumWriter(Class<T> c)
           
  SpecificDatumWriter(Schema schema)
           
protected SpecificDatumWriter(Schema root, SpecificData specificData)
           
protected SpecificDatumWriter(SpecificData specificData)
           
 
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  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, setSchema, write, write, writeArray, writeBytes, writeFixed, writeMap, writeRecord, writeString, writeString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpecificDatumWriter

public SpecificDatumWriter()

SpecificDatumWriter

public SpecificDatumWriter(Class<T> c)

SpecificDatumWriter

public SpecificDatumWriter(Schema schema)

SpecificDatumWriter

protected SpecificDatumWriter(Schema root,
                              SpecificData specificData)

SpecificDatumWriter

protected SpecificDatumWriter(SpecificData specificData)
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 IndexedRecord.

Overrides:
getField in class GenericDatumWriter<T>

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<T>
Throws:
IOException


Copyright © 2010 The Apache Software Foundation