Class: CompositePayloadConverter
Tries to convert values to Payloads using the PayloadConverterWithEncodings provided to the constructor, in the order provided.
Converts Payloads to values based on the Payload.metadata.encoding field, which matches the PayloadConverterWithEncoding.encodingType
of the converter that created the Payload.
Extended by
Implements
Constructors
Constructor
new CompositePayloadConverter(...
converters):CompositePayloadConverter
Parameters
converters
...PayloadConverterWithEncoding[]
Returns
CompositePayloadConverter
Properties
converterByEncoding
readonlyconverterByEncoding:Map<string,PayloadConverterWithEncoding>
converters
readonlyconverters:PayloadConverterWithEncoding[]
Methods
fromPayload()
fromPayload<
T>(payload,context?,hint?):T
Run PayloadConverterWithEncoding.fromPayload based on the encoding metadata of the Payload.
Type Parameters
T
T
Parameters
payload
context?
hint?
Returns
T
Implementation of
toPayload()
toPayload<
T>(value,context?,hint?):IPayload
Tries to run .toPayload(value) on each converter in the order provided at construction.
Returns the first successful result, throws ValueError if there is no converter that can handle the value.
Type Parameters
T
T
Parameters
value
T