Class LowLevelJsonSerialization

java.lang.Object
io.lionweb.lioncore.java.serialization.LowLevelJsonSerialization

public class LowLevelJsonSerialization extends Object
This class is responsible for handling serialization and deserialization from JSON and the low-level representation of models composed by SerializationBlock and the related classes.
  • Constructor Details

    • LowLevelJsonSerialization

      public LowLevelJsonSerialization()
  • Method Details

    • deserializeSerializationBlock

      public SerializedChunk deserializeSerializationBlock(com.google.gson.JsonElement jsonElement)
      This will return a lower-level representation of the information stored in JSON. It is intended to load broken models.

      Possible usages: repair a broken model, extract a language from the model ("model archeology"), etc.

      This method follows a "best-effort" approach, try to limit exception thrown and return data whenever is possible, in the measure that it is possible.

    • deserializeSerializationBlock

      public SerializedChunk deserializeSerializationBlock(String json)
      This will return a lower-level representation of the information stored in JSON. It is intended to load broken models.

      Possible usages: repair a broken model, extract a language from the model ("model archeology"), etc.

      This method follows a "best-effort" approach, try to limit exception thrown and return data whenever is possible, in the measure that it is possible.

    • deserializeSerializationBlock

      public SerializedChunk deserializeSerializationBlock(File file) throws FileNotFoundException
      This will return a lower-level representation of the information stored in JSON. It is intended to load broken models.

      Possible usages: repair a broken model, extract a language from the model ("model archeology"), etc.

      This method follows a "best-effort" approach, try to limit exception thrown and return data whenever is possible, in the measure that it is possible.

      Throws:
      FileNotFoundException
    • serializeToJsonElement

      public com.google.gson.JsonElement serializeToJsonElement(SerializedChunk serializedChunk)
    • serializeToJsonString

      public String serializeToJsonString(SerializedChunk serializedChunk)
    • groupNodesIntoSerializationBlock

      public static SerializedChunk groupNodesIntoSerializationBlock(Collection<SerializedClassifierInstance> serializedClassifierInstances, LionWebVersion lionWebVersion)
      Create a SerializedChunk containing the given nodes.