Class ReportingRpcUtils

java.lang.Object
com.inductiveautomation.reporting.common.util.ReportingRpcUtils

public class ReportingRpcUtils extends Object
  • Method Details

    • serializeToTypedElement

      public static com.inductiveautomation.ignition.common.gson.JsonElement serializeToTypedElement(Object object, com.inductiveautomation.ignition.common.gson.Gson gson)
      For objects that are subclasses of a common type, erasure can cause issues when deserializing. This method preserves the type of the object when serializing, so that it can be deserialized correctly using deserializeFromTypedElement(JsonElement, Gson, Class).
      Parameters:
      object - The object to serialize
      gson - To use for serialization
      Returns:
      A JsonElement that contains the serialized object
    • deserializeFromTypedElement

      public static <T> T deserializeFromTypedElement(com.inductiveautomation.ignition.common.gson.JsonElement element, com.inductiveautomation.ignition.common.gson.Gson context, Class<T> clazz)
      Method is used to deserialize an object that was serialized using serializeToTypedElement(Object, Gson). See that method of an explanation of the context of usage.
    • serializeToTypedElement

      public static com.inductiveautomation.ignition.common.gson.JsonElement serializeToTypedElement(Object object, com.inductiveautomation.ignition.common.gson.JsonSerializationContext context)
      For objects that are subclasses of a common type, erasure can cause issues when deserializing. This method preserves the type of the object when serializing, so that it can be deserialized correctly using deserializeFromTypedElement(JsonElement, JsonDeserializationContext, Class).
      Parameters:
      object - The object to serialize
      context - The serialization context
      Returns:
      A JsonElement that contains the serialized object
    • deserializeFromTypedElement

      public static <T> T deserializeFromTypedElement(com.inductiveautomation.ignition.common.gson.JsonElement element, com.inductiveautomation.ignition.common.gson.JsonDeserializationContext context, Class<T> clazz)
      Method is used to deserialize an object that was serialized using serializeToTypedElement(Object, JsonSerializationContext). See that method of an explanation of the context of usage.