Class ObjectMapperHelper

  • public class ObjectMapperHelper
    extends Object
    • Method Detail

      • toJSON

        public static <T> String toJSON​(T valueType)
      • toCompactJSON

        public static <T> String toCompactJSON​(T valueType)
      • viaJSON

        public static <T> T viaJSON​(T valueType)
                             throws IOException
        Useful for testing. Performs a round trip via a JSON string allowing ser/deser to be tested andv erified.

        Note that this deliberately uses a very strict ObjectMapper since we need to be sure that the source object is fully recreated without errors.

        Type Parameters:
        T - The object type
        valueType - The object to be converted
        A copy of the object performed via JSON.
        IOException - If there are deserialization issues.