Class EncoderDecoder.ChainedEnDec
java.lang.Object
io.aiven.kafka.connect.amqp.common.data.EncoderDecoder
io.aiven.kafka.connect.amqp.common.data.EncoderDecoder.ChainedEnDec
- Enclosing class:
EncoderDecoder
A EncoderDecoder that chains multiple converters together. When
encode(Object) or
decode(SchemaAndValue) is called the converters are called in chain order. The first
non-empty Optional (if any) is returned.-
Nested Class Summary
Nested classes/interfaces inherited from class io.aiven.kafka.connect.amqp.common.data.EncoderDecoder
EncoderDecoder.ChainedEnDec -
Constructor Summary
ConstructorsConstructorDescriptionChainedEnDec(EncoderDecoder... converters) Constructs a chain of converters. -
Method Summary
Modifier and TypeMethodDescriptiondecode(org.apache.kafka.connect.data.SchemaAndValue schemaAndValue) Decodes a SchemaAndValue into an object.Optional<org.apache.kafka.connect.data.SchemaAndValue>Encodes thevalueas a SchemaAndValue.protected voidsetSelf(EncoderDecoder newConverter) A method to set the EncoderDecoder against which recursive calls should be made.toString()Methods inherited from class io.aiven.kafka.connect.amqp.common.data.EncoderDecoder
andThen, self
-
Constructor Details
-
ChainedEnDec
Constructs a chain of converters.- Parameters:
converters- the chain of converters to use. Order is preserved.
-
-
Method Details
-
encode
Description copied from class:EncoderDecoderEncodes thevalueas a SchemaAndValue. If this converter can not perform the encoding it returns an emptyOptional.- Specified by:
encodein classEncoderDecoder- Parameters:
value- the value to convert.- Returns:
- the Optional SchemaAndValue or an empty Optional.
-
decode
Description copied from class:EncoderDecoderDecodes a SchemaAndValue into an object. If this converter can not perform the decoding it returns an emptyOptional.- Specified by:
decodein classEncoderDecoder- Parameters:
schemaAndValue- the schema and value to decode.- Returns:
- the Optional Object or an empty Optional if not decoded.
-
setSelf
Description copied from class:EncoderDecoderA method to set the EncoderDecoder against which recursive calls should be made. In most cases this will not be called except when the converter is used in aEncoderDecoder.ChainedEnDec.- Overrides:
setSelfin classEncoderDecoder- Parameters:
newConverter- the converter against which recursive calls should be made.
-
toString
- Overrides:
toStringin classEncoderDecoder
-