Class: CompositePayloadConverter
common.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.
Hierarchy
-
CompositePayloadConverter
Implements
Constructors
constructor
• new CompositePayloadConverter(...converters): CompositePayloadConverter
Parameters
| Name | Type |
|---|---|
...converters | PayloadConverterWithEncoding[] |
Returns
Properties
converterByEncoding
• Readonly converterByEncoding: Map<string, PayloadConverterWithEncoding>
converters
• Readonly converters: PayloadConverterWithEncoding[]
Methods
fromPayload
▸ fromPayload<T>(payload): T
Run PayloadConverterWithEncoding.fromPayload based on the encoding metadata of the Payload.
Type parameters
| Name |
|---|
T |
Parameters
| Name | Type |
|---|---|
payload | IPayload |
Returns
T
Implementation of
toPayload
▸ toPayload<T>(value): 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
| Name |
|---|
T |
Parameters
| Name | Type |
|---|---|
value | T |