Package io.temporal.common.converter
Class Jackson3JsonPayloadConverter
- java.lang.Object
-
- io.temporal.common.converter.Jackson3JsonPayloadConverter
-
- All Implemented Interfaces:
PayloadConverter
@Experimental public class Jackson3JsonPayloadConverter extends java.lang.Object implements PayloadConverter
APayloadConverterthat uses Jackson 3.x for JSON serialization/deserialization. This converter uses the same"json/plain"encoding type asJacksonJsonPayloadConverter, making it wire-compatible.This is a stub for Java versions prior to 17. On Java 17+ with Jackson 3.x on the classpath, the real implementation is loaded automatically via the multi-release JAR mechanism.
Requires Java 17+ and
tools.jackson.core:jackson-databind:3.xon the classpath.
-
-
Constructor Summary
Constructors Constructor Description Jackson3JsonPayloadConverter()Jackson3JsonPayloadConverter(boolean jackson2Compat)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> TfromData(io.temporal.api.common.v1.Payload content, java.lang.Class<T> valueType, java.lang.reflect.Type valueGenericType)Implements conversion of a single value.java.lang.StringgetEncodingType()EachPayloadConverterhas an Encoding Type that it handles.java.util.Optional<io.temporal.api.common.v1.Payload>toData(java.lang.Object value)Implements conversion of a list of values.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.temporal.common.converter.PayloadConverter
withContext
-
-
-
-
Method Detail
-
getEncodingType
public java.lang.String getEncodingType()
Description copied from interface:PayloadConverterEachPayloadConverterhas an Encoding Type that it handles. EachPayloadConvertershould add the information about its Encoding Type into thePayloadit produces insidePayloadConverter.toData(Object)by associating it with theEncodingKeys.METADATA_ENCODING_KEYkey attached to thePayload's Metadata usingPayload.Builder.putMetadata(String, ByteString).- Specified by:
getEncodingTypein interfacePayloadConverter- Returns:
- encoding type that this converter handles.
-
toData
public java.util.Optional<io.temporal.api.common.v1.Payload> toData(java.lang.Object value) throws DataConverterExceptionDescription copied from interface:PayloadConverterImplements conversion of a list of values.- Specified by:
toDatain interfacePayloadConverter- Parameters:
value- Java value to convert.- Returns:
- converted value
- Throws:
DataConverterException- if conversion of the value passed as parameter failed for any reason.- See Also:
getEncodingType javadoc for an important implementation detail
-
fromData
public <T> T fromData(io.temporal.api.common.v1.Payload content, java.lang.Class<T> valueType, java.lang.reflect.Type valueGenericType) throws DataConverterExceptionDescription copied from interface:PayloadConverterImplements conversion of a single value.- Specified by:
fromDatain interfacePayloadConverter- Parameters:
content- Serialized value to convert to a Java object.valueType- type of the value stored in thecontentvalueGenericType- generic type of the value stored in thecontent- Returns:
- converted Java object
- Throws:
DataConverterException- if conversion of the data passed as parameter failed for any reason.
-
-