Class StdConverterBackwardsCompatAdapter


  • public class StdConverterBackwardsCompatAdapter
    extends java.lang.Object
    Temporal SDK should use Standard data converter for fields needed for internal essential functionality. See comments on DefaultDataConverter.STANDARD_INSTANCE

    Unfortunately, bad code hygiene and overload of the word "default" with several meanings in DefaultDataConverter led to a situation where a user-defined converter may be used to serialize these internal fields instead. This problem is solved now and all SDK internal fields are serialized using Standard data converter. But users may already have workflows created by older SDKs and overridden "default" (in meaning "global") converter containing payloads in internal fields that must be deserialized using the user-defined converter.

    This class provides a compatibility layer for deserialization of such internal fields by first using DefaultDataConverter.STANDARD_INSTANCE and falling back to GlobalDataConverter.get() in case of an exception.

    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> T fromPayload​(io.temporal.api.common.v1.Payload payload, java.lang.Class<T> valueClass, java.lang.reflect.Type valueType)  
      static <T> T fromPayloads​(int index, java.util.Optional<io.temporal.api.common.v1.Payloads> content, java.lang.Class<T> valueType, java.lang.reflect.Type valueGenericType)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • StdConverterBackwardsCompatAdapter

        public StdConverterBackwardsCompatAdapter()
    • Method Detail

      • fromPayload

        public static <T> T fromPayload​(io.temporal.api.common.v1.Payload payload,
                                        java.lang.Class<T> valueClass,
                                        java.lang.reflect.Type valueType)
      • fromPayloads

        public static <T> T fromPayloads​(int index,
                                         java.util.Optional<io.temporal.api.common.v1.Payloads> content,
                                         java.lang.Class<T> valueType,
                                         java.lang.reflect.Type valueGenericType)
                                  throws DataConverterException
        Throws:
        DataConverterException