Package org.apache.avro.protobuf
Class ProtobufData
java.lang.Object
org.apache.avro.generic.GenericData
org.apache.avro.protobuf.ProtobufData
Utilities for serializing Protobuf 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 ProtobufData
get()
Return the singleton instance.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.getNamespace
(com.google.protobuf.Descriptors.FileDescriptor fd, com.google.protobuf.Descriptors.Descriptor containing) 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.getSchema
(com.google.protobuf.Descriptors.Descriptor descriptor) getSchema
(com.google.protobuf.Descriptors.EnumDescriptor d) getSchema
(com.google.protobuf.Descriptors.FieldDescriptor f) Return a record schema given a protobuf message class.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, getEnumSchema, getFastReaderBuilder, getFixedSchema, getNewRecordSupplier, getPrimitiveTypeCache, getSchemaName, hashCode, induce, instanceOf, isBoolean, isDouble, isEnum, isFastReaderEnabled, isFixed, isFloat, isInteger, isLong, isMap, isString, newArray, newMap, resolveUnion, setFastReaderEnabled, setStringType, toString, toString, validate
-
Constructor Details
-
ProtobufData
protected ProtobufData()
-
-
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
-
isRecord
Description copied from class:GenericData
Called by the default implementation ofGenericData.instanceOf(org.apache.avro.Schema, java.lang.Object)
.- Overrides:
isRecord
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
-
isArray
Description copied from class:GenericData
Called by the default implementation ofGenericData.instanceOf(org.apache.avro.Schema, java.lang.Object)
.- Overrides:
isArray
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
-
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 protobuf message class. -
getSchema
-
getNamespace
public String getNamespace(com.google.protobuf.Descriptors.FileDescriptor fd, com.google.protobuf.Descriptors.Descriptor containing) -
getSchema
-
getSchema
-