Package org.apache.avro.reflect
Class ReflectDatumReader<T>
java.lang.Object
org.apache.avro.generic.GenericDatumReader<T>
org.apache.avro.specific.SpecificDatumReader<T>
org.apache.avro.reflect.ReflectDatumReader<T>
- All Implemented Interfaces:
DatumReader<T>
DatumReader for existing classes via
Java reflection.-
Field Summary
Fields inherited from class org.apache.avro.specific.SpecificDatumReader
SERIALIZABLE_PACKAGES -
Constructor Summary
ConstructorsConstructorDescriptionReflectDatumReader(Class<T> c) Construct for reading instances of a class.Construct given aReflectData.ReflectDatumReader(Schema root) Construct where the writer's and reader's schemas are the same.ReflectDatumReader(Schema writer, Schema reader) Construct given writer's and reader's schema.ReflectDatumReader(Schema writer, Schema reader, ReflectData data) Construct given writer's and reader's schema and the data model. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddToArray(Object array, long pos, Object e) Called by the default implementation ofGenericDatumReader.readArray(java.lang.Object, org.apache.avro.Schema, org.apache.avro.io.ResolvingDecoder)to add a value.protected ObjectcreateString(String value) Called to create a string from a default value.protected ObjectCalled to create new array instances.protected ObjectCalled by the default implementation ofGenericDatumReader.readArray(java.lang.Object, org.apache.avro.Schema, org.apache.avro.io.ResolvingDecoder)to retrieve a value from a reused instance.protected ObjectreadArray(Object old, Schema expected, ResolvingDecoder in) Called to read an array instance.protected ObjectCalled to read byte arrays.protected voidreadField(Object record, Schema.Field field, Object oldDatum, ResolvingDecoder in, Object state) Called to read a single field of a record.protected ObjectCalled to read integers.protected ObjectreadString(Object old, Decoder in) Called to read strings.Methods inherited from class org.apache.avro.specific.SpecificDatumReader
findStringClass, getSpecificData, getTrustedPackages, readRecord, setSchemaMethods inherited from class org.apache.avro.generic.GenericDatumReader
addToMap, convert, createBytes, createEnum, createFixed, createFixed, getData, getExpected, getResolver, getSchema, newInstanceFromString, newMap, newRecord, read, read, readBytes, readEnum, readFixed, readMap, readMapKey, readString, readWithConversion, readWithoutConversion, setExpected, skip
-
Constructor Details
-
ReflectDatumReader
public ReflectDatumReader() -
ReflectDatumReader
Construct for reading instances of a class. -
ReflectDatumReader
Construct where the writer's and reader's schemas are the same. -
ReflectDatumReader
Construct given writer's and reader's schema. -
ReflectDatumReader
Construct given writer's and reader's schema and the data model. -
ReflectDatumReader
Construct given aReflectData.
-
-
Method Details
-
newArray
Description copied from class:GenericDatumReaderCalled to create new array instances. Subclasses may override to use a different array implementation. By default, this returns aGenericData.Array.- Overrides:
newArrayin classGenericDatumReader<T>
-
peekArray
Description copied from class:GenericDatumReaderCalled by the default implementation ofGenericDatumReader.readArray(java.lang.Object, org.apache.avro.Schema, org.apache.avro.io.ResolvingDecoder)to retrieve a value from a reused instance. The default implementation is forGenericArray.- Overrides:
peekArrayin classGenericDatumReader<T>
-
addToArray
Description copied from class:GenericDatumReaderCalled by the default implementation ofGenericDatumReader.readArray(java.lang.Object, org.apache.avro.Schema, org.apache.avro.io.ResolvingDecoder)to add a value. The default implementation is forCollection.- Overrides:
addToArrayin classGenericDatumReader<T>
-
readArray
Description copied from class:GenericDatumReaderCalled to read an array instance. May be overridden for alternate array representations.- Overrides:
readArrayin classGenericDatumReader<T>- Throws:
IOException
-
readString
Description copied from class:GenericDatumReaderCalled to read strings. Subclasses may override to use a different string representation. By default, this callsDecoder.readString(Utf8).- Overrides:
readStringin classGenericDatumReader<T>- Throws:
IOException
-
createString
Description copied from class:GenericDatumReaderCalled to create a string from a default value. Subclasses may override to use a different string representation. By default, this callsUtf8(String).- Overrides:
createStringin classGenericDatumReader<T>
-
readBytes
Description copied from class:GenericDatumReaderCalled to read byte arrays. Subclasses may override to use a different byte array representation. By default, this callsDecoder.readBytes(ByteBuffer).- Overrides:
readBytesin classGenericDatumReader<T>- Throws:
IOException
-
readInt
Description copied from class:GenericDatumReaderCalled to read integers. Subclasses may override to use a different integer representation. By default, this callsDecoder.readInt().- Overrides:
readIntin classGenericDatumReader<T>- Throws:
IOException
-
readField
protected void readField(Object record, Schema.Field field, Object oldDatum, ResolvingDecoder in, Object state) throws IOException Description copied from class:GenericDatumReaderCalled to read a single field of a record. May be overridden for more efficient or alternate implementations.- Overrides:
readFieldin classSpecificDatumReader<T>- Throws:
IOException
-