Package com.solace.serdes.jsonschema
Class JsonSchemaSerializer<T>
- java.lang.Object
-
- com.solace.serdes.common.AbstractSerializer<T,com.networknt.schema.JsonSchema>
-
- com.solace.serdes.jsonschema.JsonSchemaSerializer<T>
-
- Type Parameters:
T
- The type of object to be serialized. Should be mappable usingObjectMapper
- All Implemented Interfaces:
com.solace.serdes.Serializer<T>
,Closeable
,AutoCloseable
public class JsonSchemaSerializer<T> extends AbstractSerializer<T,com.networknt.schema.JsonSchema>
A Json Schema serializer that converts objects of type T into byte arrays. Configuration properties can be found inSerdeProperties
.
JsonSchemaSerializer
does not support non-header encoding of schema ID. Must useAbstractSerializer.serialize(String, Object, Map)
to ensure the schema ID is available for encoding. UsingAbstractSerializer.serialize(String, Object)
will not provide the schema ID.
Note: A Vertx connection will be made when configuring thisJsonSchemaSerializer
. Vertx threads are non-daemon and will prevent JVM exit, so always remember to callAbstractSerializer.close()
. Calling close on another thread can orphan requests ensure no calls toAbstractSerializer.serialize(String, Object, Map)
are not in progress whenAbstractSerializer.close()
is called.- See Also:
SerdeProperties
-
-
Constructor Summary
Constructors Constructor Description JsonSchemaSerializer()
Constructs a new JsonSchemaSerializer with default configuration.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
configure(Map<String,?> properties)
Configures the serializer with the given properties.-
Methods inherited from class com.solace.serdes.common.AbstractSerializer
close, serialize, serialize
-
-
-
-
Method Detail
-
configure
public void configure(Map<String,?> properties)
Description copied from class:AbstractSerializer
Configures the serializer with the given properties. Properties are defined inSerdeProperties
Note: A Vertx connection will be made when configuring thisSerializer
. Vertx threads are non-daemon and will prevent JVM exit, so always remember to callSerializer.close()
.- Specified by:
configure
in interfacecom.solace.serdes.Serializer<T>
- Overrides:
configure
in classAbstractSerializer<T,com.networknt.schema.JsonSchema>
- Parameters:
properties
- A Map containing configuration properties.- See Also:
SerdeProperties
-
-