Interface ExtensionJsonSerializer<T extends Extendable,E extends Extension<T>>

All Superinterfaces:
ExtensionProvider<T,E>
All Known Subinterfaces:
JsonDynamicSimulationParameters.ExtensionSerializer<E>, JsonShortCircuitParameters.ExtensionSerializer<E>
All Known Implementing Classes:
ActivePowerExtensionSerializer, CurrentExtensionSerializer, VoltageExtensionSerializer

public interface ExtensionJsonSerializer<T extends Extendable,E extends Extension<T>> extends ExtensionProvider<T,E>
An ExtensionProvider able to serialize/deserialize extensions from JSON.
Author:
Mathieu Bague <mathieu.bague at rte-france.com>
  • Method Summary

    Modifier and Type
    Method
    Description
    deserialize(com.fasterxml.jackson.core.JsonParser jsonParser, com.fasterxml.jackson.databind.DeserializationContext deserializationContext)
    Deserializes the provided JSON to an extension of type E.
    default E
    deserializeAndUpdate(com.fasterxml.jackson.core.JsonParser jsonParser, com.fasterxml.jackson.databind.DeserializationContext deserializationContext, E extension)
    Deserializes the provided JSON to update the provided extension.
    void
    serialize(E extension, com.fasterxml.jackson.core.JsonGenerator jsonGenerator, com.fasterxml.jackson.databind.SerializerProvider serializerProvider)
    Serializes the provided extension to JSON.

    Methods inherited from interface com.powsybl.commons.extensions.ExtensionProvider

    getCategoryName, getExtensionClass, getExtensionName
  • Method Details

    • serialize

      void serialize(E extension, com.fasterxml.jackson.core.JsonGenerator jsonGenerator, com.fasterxml.jackson.databind.SerializerProvider serializerProvider) throws IOException
      Serializes the provided extension to JSON.
      Throws:
      IOException
    • deserialize

      E deserialize(com.fasterxml.jackson.core.JsonParser jsonParser, com.fasterxml.jackson.databind.DeserializationContext deserializationContext) throws IOException
      Deserializes the provided JSON to an extension of type E.
      Throws:
      IOException
    • deserializeAndUpdate

      default E deserializeAndUpdate(com.fasterxml.jackson.core.JsonParser jsonParser, com.fasterxml.jackson.databind.DeserializationContext deserializationContext, E extension) throws IOException
      Deserializes the provided JSON to update the provided extension. Returns the updated extension.

      The default implementation only returns a new object as provided by deserialize(JsonParser, DeserializationContext), therefore interface implementations must provide their own implementation if they want the extension to actually be updatable from JSON.

      Throws:
      IOException