Class PolymorphicSerialization


  • public final class PolymorphicSerialization
    extends java.lang.Object
    Class containing all tools and classes needed to serialize and deserialize polymorphic maps
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> T deserializeCompound​(com.fasterxml.jackson.databind.JsonNode node, com.fasterxml.jackson.databind.DeserializationContext deserializationContext)
      Deserializes object from provided JSON node.
      static <T> T deserializeCompound​(java.lang.Class<T> type, com.fasterxml.jackson.databind.JsonNode arrayNode, int currentIndex, com.fasterxml.jackson.databind.DeserializationContext deserializationContext)
      Deserializes object of specified type using provided parser.
      static void serializeCompound​(java.lang.Object o, com.fasterxml.jackson.core.JsonGenerator jsonGenerator)
      Serializes provided object as a compound type (incl.
      • Methods inherited from class java.lang.Object

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

      • serializeCompound

        public static void serializeCompound​(java.lang.Object o,
                                             com.fasterxml.jackson.core.JsonGenerator jsonGenerator)
                                      throws java.io.IOException
        Serializes provided object as a compound type (incl. class name).
        Parameters:
        o - object to be serialized (may be null)
        jsonGenerator - generator
        Throws:
        java.io.IOException - thrown when object may not be serialized
      • deserializeCompound

        public static <T> T deserializeCompound​(com.fasterxml.jackson.databind.JsonNode node,
                                                com.fasterxml.jackson.databind.DeserializationContext deserializationContext)
                                         throws java.io.IOException
        Deserializes object from provided JSON node. An object may be null, String or compound value in format of [class, value].
        Type Parameters:
        T - type of value to be read
        Parameters:
        node - JSON node to be interpreted
        deserializationContext - context
        Returns:
        value read
        Throws:
        java.io.IOException - thrown when read is not possible
      • deserializeCompound

        public static <T> T deserializeCompound​(java.lang.Class<T> type,
                                                com.fasterxml.jackson.databind.JsonNode arrayNode,
                                                int currentIndex,
                                                com.fasterxml.jackson.databind.DeserializationContext deserializationContext)
                                         throws java.lang.IllegalAccessException,
                                                java.lang.InstantiationException,
                                                java.io.IOException
        Deserializes object of specified type using provided parser. Method assumes that parser is set on first token to be read by method. It end execution leaving parser right after last read token.
        Type Parameters:
        T - type of value to be read
        Parameters:
        type - expected type of value
        deserializationContext - context
        Returns:
        value read
        Throws:
        java.io.IOException - thrown when read is not possible
        java.lang.IllegalAccessException
        java.lang.InstantiationException