Class JsonUtils

java.lang.Object
com.datastax.astra.internal.utils.JsonUtils

public class JsonUtils extends Object
Custom implementation of serialization : faster + no jackson dependency
Author:
Cedrick Lunven (@clunven)
  • Method Details

    • getDataApiObjectMapper

      public static com.fasterxml.jackson.databind.ObjectMapper getDataApiObjectMapper()
      Building the data api specific object mapper.
      Returns:
      object mapper.
    • marshall

      public static String marshall(Object o)
      Transform object as a String.
      Parameters:
      o - object to be serialized.
      Returns:
      body as String
    • convertValue

      public static <T> T convertValue(Object bean, Class<T> clazz)
      Jackson deserialization.
      Type Parameters:
      T - current type
      Parameters:
      bean - current beam
      clazz - target class
      Returns:
      serialized
    • unMarshallBean

      public static <T> T unMarshallBean(String body, Class<T> ref)
      Load body as expected object.
      Type Parameters:
      T - parameter
      Parameters:
      body - response body as String
      ref - type Reference to map the result
      Returns:
      expected objects