T
- the type to be serializedpublic class RegistryAvroSerializationSchema<T> extends AvroSerializationSchema<T>
SerializationSchema.InitializationContext
Modifier and Type | Field and Description |
---|---|
protected SchemaCoder |
schemaCoder |
Constructor and Description |
---|
RegistryAvroSerializationSchema(Class<T> recordClazz,
org.apache.avro.Schema schema,
SchemaCoder.SchemaCoderProvider schemaCoderProvider)
Creates a Avro serialization schema.
|
Modifier and Type | Method and Description |
---|---|
protected void |
checkAvroInitialized() |
boolean |
equals(Object o) |
static RegistryAvroSerializationSchema<org.apache.avro.generic.GenericRecord> |
forGeneric(org.apache.avro.Schema schema,
SchemaCoder.SchemaCoderProvider schemaCoderProvider) |
static <T extends org.apache.avro.specific.SpecificRecord> |
forSpecific(Class<T> tClass,
SchemaCoder.SchemaCoderProvider schemaCoderProvider) |
int |
hashCode() |
byte[] |
serialize(T object)
Serializes the incoming element to a specified type.
|
forGeneric, forSpecific, getDatumWriter, getEncoder, getOutputStream, getSchema
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
open
protected SchemaCoder schemaCoder
public RegistryAvroSerializationSchema(Class<T> recordClazz, org.apache.avro.Schema schema, SchemaCoder.SchemaCoderProvider schemaCoderProvider)
recordClazz
- class to serialize. Should be either SpecificRecord
or GenericRecord
.schema
- writers's Avro schema. Should be provided if recordClazz is GenericRecord
schemaCoderProvider
- schema provider that allows instantiation of SchemaCoder
that will be used for schema writingpublic static <T extends org.apache.avro.specific.SpecificRecord> RegistryAvroSerializationSchema<T> forSpecific(Class<T> tClass, SchemaCoder.SchemaCoderProvider schemaCoderProvider)
public static RegistryAvroSerializationSchema<org.apache.avro.generic.GenericRecord> forGeneric(org.apache.avro.Schema schema, SchemaCoder.SchemaCoderProvider schemaCoderProvider)
public byte[] serialize(T object)
SerializationSchema
serialize
in interface SerializationSchema<T>
serialize
in class AvroSerializationSchema<T>
object
- The incoming element to be serializedprotected void checkAvroInitialized()
checkAvroInitialized
in class AvroSerializationSchema<T>
public boolean equals(Object o)
equals
in class AvroSerializationSchema<T>
public int hashCode()
hashCode
in class AvroSerializationSchema<T>
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.