Package org.apache.avro.thrift
Class ThriftData
java.lang.Object
org.apache.avro.generic.GenericData
org.apache.avro.thrift.ThriftData
Utilities for serializing Thrift data in Avro format.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.avro.generic.GenericData
GenericData.AbstractArray<T>, GenericData.Array<T>, GenericData.EnumSymbol, GenericData.Fixed, GenericData.InstanceSupplier, GenericData.Record, GenericData.StringType
-
Field Summary
Fields inherited from class org.apache.avro.generic.GenericData
FAST_READER_PROP, STRING_PROP, STRING_TYPE_STRING
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncreateDatumReader
(Schema schema) Returns aDatumReader
for this kind of data.createDatumWriter
(Schema schema) Returns aDatumWriter
for this kind of data.static ThriftData
get()
Return the singleton instance.protected Schema
getEnumSchema
(Object datum) Called to obtain the schema of a enum.Called byGenericDatumReader.readRecord(java.lang.Object, org.apache.avro.Schema, org.apache.avro.io.ResolvingDecoder)
to retrieve a record field value from a reused instance.protected Object
Version ofGenericData.getField(java.lang.Object, java.lang.String, int)
that has state.protected Schema
getRecordSchema
(Object record) Called to obtain the schema of a record.protected Object
getRecordState
(Object r, Schema s) Produce state for repeated calls toGenericData.getField(Object,String,int,Object)
andGenericData.setField(Object,String,int,Object,Object)
on the same record.Return a record schema given a thrift generated class.protected String
getSchemaName
(Object datum) Return the schema full name for a datum.protected boolean
Called by the default implementation ofGenericData.instanceOf(org.apache.avro.Schema, java.lang.Object)
.protected boolean
Called by the default implementation ofGenericData.instanceOf(org.apache.avro.Schema, java.lang.Object)
.protected boolean
Called by the default implementation ofGenericData.instanceOf(org.apache.avro.Schema, java.lang.Object)
.Called to create new record instances.void
Called byGenericDatumReader.readRecord(java.lang.Object, org.apache.avro.Schema, org.apache.avro.io.ResolvingDecoder)
to set a record fields value to a record instance.protected void
Version ofGenericData.setField(java.lang.Object, java.lang.String, int, java.lang.Object)
that has state.Methods inherited from class org.apache.avro.generic.GenericData
addLogicalTypeConversion, compare, compare, compareMaps, createDatumReader, createEnum, createFixed, createFixed, createString, deepCopy, getArrayAsCollection, getClassLoader, getConversionByClass, getConversionByClass, getConversionFor, getConversions, getDefaultValue, getFastReaderBuilder, getFixedSchema, getNewRecordSupplier, getPrimitiveTypeCache, hashCode, induce, instanceOf, isArray, isBoolean, isDouble, isFastReaderEnabled, isFixed, isFloat, isInteger, isLong, isMap, isString, newArray, newMap, resolveUnion, setFastReaderEnabled, setStringType, toString, toString, validate
-
Constructor Details
-
ThriftData
protected ThriftData()
-
-
Method Details
-
get
Return the singleton instance. -
createDatumReader
Description copied from class:GenericData
Returns aDatumReader
for this kind of data.- Overrides:
createDatumReader
in classGenericData
-
createDatumWriter
Description copied from class:GenericData
Returns aDatumWriter
for this kind of data.- Overrides:
createDatumWriter
in classGenericData
-
setField
Description copied from class:GenericData
Called byGenericDatumReader.readRecord(java.lang.Object, org.apache.avro.Schema, org.apache.avro.io.ResolvingDecoder)
to set a record fields value to a record instance. The default implementation is forIndexedRecord
.- Overrides:
setField
in classGenericData
-
getField
Description copied from class:GenericData
Called byGenericDatumReader.readRecord(java.lang.Object, org.apache.avro.Schema, org.apache.avro.io.ResolvingDecoder)
to retrieve a record field value from a reused instance. The default implementation is forIndexedRecord
.- Overrides:
getField
in classGenericData
-
setField
Description copied from class:GenericData
Version ofGenericData.setField(java.lang.Object, java.lang.String, int, java.lang.Object)
that has state.- Overrides:
setField
in classGenericData
-
getField
Description copied from class:GenericData
Version ofGenericData.getField(java.lang.Object, java.lang.String, int)
that has state.- Overrides:
getField
in classGenericData
-
getRecordState
Description copied from class:GenericData
Produce state for repeated calls toGenericData.getField(Object,String,int,Object)
andGenericData.setField(Object,String,int,Object,Object)
on the same record.- Overrides:
getRecordState
in classGenericData
-
getSchemaName
Description copied from class:GenericData
Return the schema full name for a datum. Called byGenericData.resolveUnion(Schema,Object)
.- Overrides:
getSchemaName
in classGenericData
-
isRecord
Description copied from class:GenericData
Called by the default implementation ofGenericData.instanceOf(org.apache.avro.Schema, java.lang.Object)
.- Overrides:
isRecord
in classGenericData
-
isEnum
Description copied from class:GenericData
Called by the default implementation ofGenericData.instanceOf(org.apache.avro.Schema, java.lang.Object)
.- Overrides:
isEnum
in classGenericData
-
getEnumSchema
Description copied from class:GenericData
Called to obtain the schema of a enum. By default calls {GenericContainer#getSchema(). May be overridden for alternate enum representations.- Overrides:
getEnumSchema
in classGenericData
-
isBytes
Description copied from class:GenericData
Called by the default implementation ofGenericData.instanceOf(org.apache.avro.Schema, java.lang.Object)
.- Overrides:
isBytes
in classGenericData
-
newRecord
Description copied from class:GenericData
Called to create new record instances. Subclasses may override to use a different record implementation. The returned instance must conform to the schema provided. If the old object contains fields not present in the schema, they should either be removed from the old object, or it should create a new instance that conforms to the schema. By default, this returns aGenericData.Record
.- Overrides:
newRecord
in classGenericData
-
getRecordSchema
Description copied from class:GenericData
Called to obtain the schema of a record. By default calls {GenericContainer#getSchema(). May be overridden for alternate record representations.- Overrides:
getRecordSchema
in classGenericData
-
getSchema
Return a record schema given a thrift generated class.
-