Interface AvroConverterStrategy
- All Superinterfaces:
DescribableComponent,Predicate<Class<?>>
- All Known Implementing Classes:
SpecificRecordBaseConverterStrategy
Strategy for Avro Converter. A strategy is selected upon the representation of the object in your runtime, assuming
that the binary representation is always a binary byte array.
- Since:
- 4.11.0
- Author:
- Simon Zambrovski, Jan Galinski
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidapplyStrategyConfiguration(AvroConverterStrategyConfiguration avroConverterStrategyConfiguration) Sets the configuration for the strategy.<T> TconvertFromGenericRecord(org.apache.avro.generic.GenericRecord genericRecord, Class<T> type) Converts from Apache Avro generic record (intermediate representation).<T> TconvertFromSingleObjectEncoded(byte[] bytes, Class<T> type) Converts from single object encoded byte array.byte[]convertToSingleObjectEncoded(Object object) Converts the givenobjectto byte array using Avro single-object-encoding.booleanDetermines if this strategy supports givenpayloadType.Methods inherited from interface org.axonframework.common.infra.DescribableComponent
describeTo
-
Method Details
-
test
Determines if this strategy supports givenpayloadType. This means that we have either aSpecificRecordBasegenerated from a schema using apache-avro-maven-plugin or a kotlinx serializable class, written using avro4k. -
convertToSingleObjectEncoded
Converts the givenobjectto byte array using Avro single-object-encoding.- Parameters:
object- The object to convert.- Returns:
- The byte array containing Avro Single Object Encoded bytes.
-
convertFromSingleObjectEncoded
Converts from single object encoded byte array.- Type Parameters:
T- The payload type to convert to.- Parameters:
bytes- An array containing single-object-encoded bytes.type- The class of resulting object.- Returns:
- The deserialized object.
-
convertFromGenericRecord
<T> T convertFromGenericRecord(@Nonnull org.apache.avro.generic.GenericRecord genericRecord, @Nonnull Class<T> type) Converts from Apache Avro generic record (intermediate representation).- Type Parameters:
T- The payload type to convert to.- Parameters:
genericRecord- The input object containing the generic record.type- The class of resulting object.- Returns:
- deserialized object.
-
applyStrategyConfiguration
default void applyStrategyConfiguration(@Nonnull AvroConverterStrategyConfiguration avroConverterStrategyConfiguration) Sets the configuration for the strategy.This method is called during the construction of
AvroConverter, passing the 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 passed via
AvroConverterStrategyConfiguration- Parameters:
avroConverterStrategyConfiguration- configuration passed after construction.
-