Class JsonProtoConverter
- Namespace
- Temporalio.Converters
- Assembly
- Temporalio.dll
Encoding converter for protobuf JSON data.
public class JsonProtoConverter : IEncodingConverter
- Inheritance
-
JsonProtoConverter
- Implements
- Inherited Members
Constructors
JsonProtoConverter()
Initializes a new instance of the JsonProtoConverter class.
public JsonProtoConverter()
JsonProtoConverter(JsonFormatter, JsonParser)
Initializes a new instance of the JsonProtoConverter class.
public JsonProtoConverter(JsonFormatter formatter, JsonParser parser)
Parameters
formatter
JsonFormatterFormatter used when converting to JSON.
parser
JsonParserParser used when converting from JSON.
Properties
Encoding
Gets the encoding name this converter represents.
public string Encoding { get; }
Property Value
Remarks
Implementers must put this value on the "encoding" metadata of created payloads.
Formatter
Gets the formatter used when converting to JSON.
protected JsonFormatter Formatter { get; }
Property Value
- JsonFormatter
Parser
Gets the parser used when converting from JSON.
protected JsonParser Parser { get; }
Property Value
- JsonParser
Methods
ToValue(Payload, Type)
Convert the given payload to the given type or error.
public object? ToValue(Payload payload, Type type)
Parameters
Returns
- object
The converted value.
Remarks
This call is guaranteed to only be called for payloads whose metadata match Encoding. This should error if it cannot convert to the given type.
TryToPayload(object?, out Payload?)
Try to convert the given value to the given payload or return false if this converter cannot handle it and the next should be tried.
public bool TryToPayload(object? value, out Payload? payload)
Parameters
Returns
- bool
True if this converter can and has converted the value.
Remarks
Implementers must put the Encoding value on the "encoding" metadata of created payloads.