Class DefaultSchemaResolver<T,S>
- java.lang.Object
-
- com.solace.serdes.common.resolver.DefaultSchemaResolver<T,S>
-
- Type Parameters:
T
- The type of object to be serialized/deserializedS
- The type of schema
- All Implemented Interfaces:
SchemaResolver<T,S>
,Closeable
,AutoCloseable
public class DefaultSchemaResolver<T,S> extends Object implements SchemaResolver<T,S>
Default implementation of the SchemaResolver interface for Solace Schema Registry. This class handles schema resolution, caching, and registry interactions for serialization and deserialization operations.The DefaultSchemaResolver manages schema lookups, caching, and resolution of schema references. It supports various lookup strategies including by content ID, global ID, or artifact coordinates. It also provides options for auto-registering schemas and finding the latest versions.
-
-
Constructor Summary
Constructors Constructor Description DefaultSchemaResolver()
Constructs a DefaultSchemaResolver.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes this schema resolver and releases any system resources associated with it.void
configure(Map<String,?> properties)
Configures thisSchemaResolver
with the given configuration properties.SchemaLookUpResults<S>
resolveSchema(Record<T> data)
Resolves a schema based on the given record.SchemaLookUpResults<S>
resolveSchema(ArtifactReference exactReference)
Resolves a schema based on the given artifact reference.void
setSchemaParser(SchemaParser<S,T> schemaParser)
Sets the schema parser for theSchemaResolver
.
-
-
-
Method Detail
-
configure
public void configure(Map<String,?> properties)
Description copied from interface:SchemaResolver
Configures thisSchemaResolver
with the given configuration properties.- Specified by:
configure
in interfaceSchemaResolver<T,S>
- Parameters:
properties
- the configuration properties
-
resolveSchema
public SchemaLookUpResults<S> resolveSchema(ArtifactReference exactReference)
Description copied from interface:SchemaResolver
Resolves a schema based on the given artifact reference.- Specified by:
resolveSchema
in interfaceSchemaResolver<T,S>
- Parameters:
exactReference
- The artifact reference used to look up the schema.- Returns:
- A
SchemaLookUpResults
object containing the resolved schema and related information.
-
close
public void close()
Description copied from interface:SchemaResolver
Closes this schema resolver and releases any system resources associated with it. This method is called automatically when the resolver is used in a try-with-resources statement.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceSchemaResolver<T,S>
-
setSchemaParser
public void setSchemaParser(SchemaParser<S,T> schemaParser)
Description copied from interface:SchemaResolver
Sets the schema parser for theSchemaResolver
.- Specified by:
setSchemaParser
in interfaceSchemaResolver<T,S>
- Parameters:
schemaParser
- the schema parser to be used when resolving schemas.
-
resolveSchema
public SchemaLookUpResults<S> resolveSchema(Record<T> data)
Description copied from interface:SchemaResolver
Resolves a schema based on the given record.- Specified by:
resolveSchema
in interfaceSchemaResolver<T,S>
- Parameters:
data
- The record used to look up the schema.- Returns:
- A
SchemaLookUpResults
object containing the resolved schema and related information.
-
-