Package io.apicurio.registry.serde
Class AbstractSerializer<T,U>
java.lang.Object
io.apicurio.registry.serde.AbstractSerializer<T,U>
- All Implemented Interfaces:
AutoCloseable
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractSerializer(RegistryClientFacade clientFacade) AbstractSerializer(RegistryClientFacade clientFacade, SchemaResolver<T, U> schemaResolver) AbstractSerializer(RegistryClientFacade clientFacade, ArtifactReferenceResolverStrategy<T, U> strategy, SchemaResolver<T, U> schemaResolver) AbstractSerializer(SchemaResolver<T, U> schemaResolver) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidconfigure(SerdeConfig config, boolean isKey) protected ObjectgetSchemaCacheKey(U data) Gets a cache key for the schema associated with this data.abstract SchemaParser<T, U> abstract voidserializeData(ParsedSchema<T> schema, U data, OutputStream out) byte[]serializeData(String topic, U data)
-
Constructor Details
-
AbstractSerializer
public AbstractSerializer() -
AbstractSerializer
-
AbstractSerializer
-
AbstractSerializer
-
AbstractSerializer
public AbstractSerializer(RegistryClientFacade clientFacade, ArtifactReferenceResolverStrategy<T, U> strategy, SchemaResolver<T, U> schemaResolver)
-
-
Method Details
-
schemaParser
-
serializeData
public abstract void serializeData(ParsedSchema<T> schema, U data, OutputStream out) throws IOException - Throws:
IOException
-
getSchemaCacheKey
Gets a cache key for the schema associated with this data. For types where the schema is tied to the class (e.g., Avro SpecificRecord, Protobuf GeneratedMessage), this should return the class object. For types where the schema varies per instance (e.g., Avro GenericRecord), this should return an object that uniquely identifies the schema (e.g., the Schema object itself). For types where caching is not safe, this should return null. Subclasses should override this method to provide type-specific logic. The default implementation returns null (no caching).- Parameters:
data- the data to get a cache key for- Returns:
- an object suitable as a cache key, or null if caching is not safe
-
configure
-
serializeData
-
getSerdeConfigurer
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-