Top Description Constructors Methods
org.apache.avro.reflect

public Class ReflectDatumReader<T>

extends SpecificDatumReader<T>
Class Inheritance
Imports
java.io.IOException, java.lang.reflect.Array, java.nio.ByteBuffer, java.util.ArrayList, .HashSet, .HashMap, .Collection, .Map, org.apache.avro.AvroRuntimeException, .Conversion, .LogicalType, .Schema, .Schema.Field, org.apache.avro.generic.IndexedRecord, org.apache.avro.io.Decoder, .ResolvingDecoder, org.apache.avro.specific.SpecificData, .SpecificDatumReader

DatumReader for existing classes via Java reflection.

Constructor Summary

AccessConstructor and Description
public
public
ReflectDatumReader(Class<T> c)

Construct for reading instances of a class.

public
ReflectDatumReader(Schema root)

Construct where the writer's and reader's schemas are the same.

public
ReflectDatumReader(Schema writer, Schema reader)

Construct given writer's and reader's schema.

public
ReflectDatumReader(Schema writer, Schema reader, ReflectData data)

Construct given writer's and reader's schema and the data model.

public
ReflectDatumReader(ReflectData data)

Construct given a ReflectData.

Method Summary

Modifier and TypeMethod and Description
protected void
addToArray(Object array, long pos, Object e)

Overrides org.apache.avro.generic.GenericDatumReader.addToArray.

Called by the default implementation of readArray to add a value.
protected Object
createString(String value)

Overrides org.apache.avro.generic.GenericDatumReader.createString.

Called to create a string from a default value.
protected Object
newArray(Object old, int size, Schema schema)

Overrides org.apache.avro.generic.GenericDatumReader.newArray.

Called to create new array instances.
protected Object
peekArray(Object array)

Overrides org.apache.avro.generic.GenericDatumReader.peekArray.

Called by the default implementation of readArray to retrieve a value from a reused instance.
protected Object
readArray(Object old, Schema expected, ResolvingDecoder in)

Overrides org.apache.avro.generic.GenericDatumReader.readArray.

Called to read an array instance.
protected Object
readBytes(Object old, Schema s, Decoder in)

Overrides org.apache.avro.generic.GenericDatumReader.readBytes.

Called to read byte arrays.
private Object
readCollection(Collection<Object> c, Schema expectedType, long l, ResolvingDecoder in)

protected void
readField(Object record, Schema.Field field, Object oldDatum, ResolvingDecoder in, Object state)

Overrides org.apache.avro.specific.SpecificDatumReader.readField.

Called to read a single field of a record.
protected Object
readInt(Object old, Schema expected, Decoder in)

Overrides org.apache.avro.generic.GenericDatumReader.readInt.

Called to read integers.
private Object
readJavaArray(Object array, Schema expectedType, long l, ResolvingDecoder in)

private Object
readObjectArray(Object[] array, Schema expectedType, long l, ResolvingDecoder in)

private Object
protected Object
Inherited from org.apache.avro.specific.SpecificDatumReader:
findStringClassgetSpecificDatareadRecordsetSchema

Constructor Detail

ReflectDatumReaderback to summary
public ReflectDatumReader()
ReflectDatumReaderback to summary
public ReflectDatumReader(Class<T> c)

Construct for reading instances of a class.

ReflectDatumReaderback to summary
public ReflectDatumReader(Schema root)

Construct where the writer's and reader's schemas are the same.

ReflectDatumReaderback to summary
public ReflectDatumReader(Schema writer, Schema reader)

Construct given writer's and reader's schema.

ReflectDatumReaderback to summary
public ReflectDatumReader(Schema writer, Schema reader, ReflectData data)

Construct given writer's and reader's schema and the data model.

ReflectDatumReaderback to summary
public ReflectDatumReader(ReflectData data)

Construct given a ReflectData.

Method Detail

addToArrayback to summary
protected void addToArray(Object array, long pos, Object e)

Overrides org.apache.avro.generic.GenericDatumReader.addToArray.

Doc from org.apache.avro.generic.GenericDatumReader.addToArray.

Called by the default implementation of readArray to add a value. The default implementation is for Collection.

Annotations
@Override
createStringback to summary
protected Object createString(String value)

Overrides org.apache.avro.generic.GenericDatumReader.createString.

Doc from org.apache.avro.generic.GenericDatumReader.createString.

Called to create a string from a default value. Subclasses may override to use a different string representation. By default, this calls Utf8#Utf8(String).

Annotations
@Override
newArrayback to summary
protected Object newArray(Object old, int size, Schema schema)

Overrides org.apache.avro.generic.GenericDatumReader.newArray.

Doc from org.apache.avro.generic.GenericDatumReader.newArray.

Called to create new array instances. Subclasses may override to use a different array implementation. By default, this returns a GenericData.Array.

Annotations
@Override
peekArrayback to summary
protected Object peekArray(Object array)

Overrides org.apache.avro.generic.GenericDatumReader.peekArray.

Doc from org.apache.avro.generic.GenericDatumReader.peekArray.

Called by the default implementation of readArray to retrieve a value from a reused instance. The default implementation is for GenericArray.

Annotations
@Override
readArrayback to summary
protected Object readArray(Object old, Schema expected, ResolvingDecoder in) throws IOException

Overrides org.apache.avro.generic.GenericDatumReader.readArray.

Doc from org.apache.avro.generic.GenericDatumReader.readArray.

Called to read an array instance. May be overridden for alternate array representations.

Annotations
@Override
readBytesback to summary
protected Object readBytes(Object old, Schema s, Decoder in) throws IOException

Overrides org.apache.avro.generic.GenericDatumReader.readBytes.

Doc from org.apache.avro.generic.GenericDatumReader.readBytes.

Called to read byte arrays. Subclasses may override to use a different byte array representation. By default, this calls Decoder#readBytes(ByteBuffer).

Annotations
@Override
readCollectionback to summary
private Object readCollection(Collection<Object> c, Schema expectedType, long l, ResolvingDecoder in) throws IOException
readFieldback to summary
protected void readField(Object record, Schema.Field field, Object oldDatum, ResolvingDecoder in, Object state) throws IOException

Overrides org.apache.avro.specific.SpecificDatumReader.readField.

Doc from org.apache.avro.generic.GenericDatumReader.readField.

Called to read a single field of a record. May be overridden for more efficient or alternate implementations.

Annotations
@Override
readIntback to summary
protected Object readInt(Object old, Schema expected, Decoder in) throws IOException

Overrides org.apache.avro.generic.GenericDatumReader.readInt.

Doc from org.apache.avro.generic.GenericDatumReader.readInt.

Called to read integers. Subclasses may override to use a different integer representation. By default, this calls Decoder#readInt().

Annotations
@Override
readJavaArrayback to summary
private Object readJavaArray(Object array, Schema expectedType, long l, ResolvingDecoder in) throws IOException
readObjectArrayback to summary
private Object readObjectArray(Object[] array, Schema expectedType, long l, ResolvingDecoder in) throws IOException
readPrimitiveArrayback to summary
private Object readPrimitiveArray(Object array, Class<?> c, long l, ResolvingDecoder in) throws IOException
readStringback to summary
protected Object readString(Object old, Decoder in) throws IOException

Overrides org.apache.avro.generic.GenericDatumReader.readString.

Doc from org.apache.avro.generic.GenericDatumReader.readString.

Called to read strings. Subclasses may override to use a different string representation. By default, this calls Decoder#readString(Utf8).

Annotations
@Override