public interface AvroSerializerStrategy extends Predicate<Class<?>>
Modifier and Type | Method and Description |
---|---|
default void |
applyConfig(AvroSerializerStrategyConfig avroSerializerStrategyConfig)
Sets the configuration for the strategy.
|
<T> T |
deserializeFromGenericRecord(SerializedObject<org.apache.avro.generic.GenericRecord> serializedObject,
Class<T> type)
Deserializes from Apache Avro generic record (intermediate representation).
|
<T> T |
deserializeFromSingleObjectEncoded(SerializedObject<byte[]> serializedObject,
Class<T> type)
Deserializes from single object encoded byte array.
|
SerializedObject<byte[]> |
serializeToSingleObjectEncoded(Object object)
Serializes object to byte array using Avro single-object-encoding.
|
boolean |
test(Class<?> payloadType)
Determines if this strategy supports given
payloadType . |
boolean test(Class<?> payloadType)
payloadType
. This means that we have either a SpecificRecordBase
generated
from a schema using apache-avro-maven-plugin or a kotlinx serializable class, written using avro4k.@Nonnull SerializedObject<byte[]> serializeToSingleObjectEncoded(@Nonnull Object object)
object
- object to serialize.@Nonnull <T> T deserializeFromSingleObjectEncoded(@Nonnull SerializedObject<byte[]> serializedObject, @Nonnull Class<T> type)
T
- payload type to deserialize to.serializedObject
- serialized object containing single-object-encoded bytes.type
- class of resulting object.<T> T deserializeFromGenericRecord(SerializedObject<org.apache.avro.generic.GenericRecord> serializedObject, Class<T> type)
T
- payload type to deserialize to.serializedObject
- serialized object containing the generic record.type
- class of resulting object.default void applyConfig(AvroSerializerStrategyConfig avroSerializerStrategyConfig)
This method is called by the AvroSerializer.Builder
during instantiation of AvroSerializer
,
passing the builder configuration to the strategy. The default implementation does nothing, but a strategy might
use this method to set up internals.
This method is intended to be implemented by the strategy, if it supports configuration options set by the
AvroSerializer.Builder
, passed via AvroSerializerStrategyConfig
avroSerializerStrategyConfig
- configuration passed by the builder.Copyright © 2010–2025. All rights reserved.