ApacheAvroSerializerBuilder Class

  • java.lang.Object
    • com.azure.core.serializer.avro.apache.ApacheAvroSerializerBuilder

public class ApacheAvroSerializerBuilder

Fluent builder class that configures and instantiates instances of ApacheAvroSerializer.

Constructor Summary

Constructor Description
ApacheAvroSerializerBuilder()

Creates an instance of ApacheAvroSerializerBuilder.

Method Summary

Modifier and Type Method and Description
AvroSerializer build()

Instantiates a new instance of ApacheAvroSerializer based on the configurations set on the builder.

ApacheAvroSerializerBuilder decoderFactory(DecoderFactory decoderFactory)

Configures the DecoderFactory that will be used to deserialize the Avro stream into an object.

ApacheAvroSerializerBuilder encoderFactory(EncoderFactory encoderFactory)

Configures the EncoderFactory that will be used to serialize an object into an Avro stream.

ApacheAvroSerializerBuilder schema(String schema)

Configures the schema that will be associated to the ApacheAvroSerializer when build() is called.

ApacheAvroSerializerBuilder specificData(SpecificData specificData)

Configures the SpecificData that will be used during serialization and deserialization of Avro.

Methods inherited from java.lang.Object

Constructor Details

ApacheAvroSerializerBuilder

public ApacheAvroSerializerBuilder()

Creates an instance of ApacheAvroSerializerBuilder.

Method Details

build

public AvroSerializer build()

Instantiates a new instance of ApacheAvroSerializer based on the configurations set on the builder.

Returns:

A new instance of ApacheAvroSerializer.

decoderFactory

public ApacheAvroSerializerBuilder decoderFactory(DecoderFactory decoderFactory)

Configures the DecoderFactory that will be used to deserialize the Avro stream into an object.

If decoderFactory is null when build() is called DecoderFactory.get() will be used as the decoder factory.

Parameters:

decoderFactory - The DecoderFactory used to deserialize the Avro stream into an object.

Returns:

The updated ApacheAvroSerializerBuilder object.

encoderFactory

public ApacheAvroSerializerBuilder encoderFactory(EncoderFactory encoderFactory)

Configures the EncoderFactory that will be used to serialize an object into an Avro stream.

If encoderFactory is null when build() is called EncoderFactory.get() will be used as the encoder factory.

Parameters:

encoderFactory - The EncoderFactory used to serialize an object into an Avro stream.

Returns:

The updated ApacheAvroSerializerBuilder object.

schema

public ApacheAvroSerializerBuilder schema(String schema)

Configures the schema that will be associated to the ApacheAvroSerializer when build() is called.

Parameters:

schema - Avro schema to associate to the serializer that is built.

Returns:

The updated ApacheAvroSerializerBuilder object.

specificData

public ApacheAvroSerializerBuilder specificData(SpecificData specificData)

Configures the SpecificData that will be used during serialization and deserialization of Avro.

If specificData is null when build() is called SpecificData.get() will be used as the generic data.

Parameters:

specificData - The SpecificData used during serialization and deserialization of Avro.

Returns:

The updated ApacheAvroSerializerBuilder object.

Applies to