Interface JsonResourceCodec<R>

All Superinterfaces:
ResourceCodec<R>
All Known Implementing Classes:
ExtensionPointResourceCodec, GsonResourceCodec, JsonResourceCodecWrapper

public interface JsonResourceCodec<R> extends ResourceCodec<R>
  • Method Summary

    Modifier and Type
    Method
    Description
    static com.inductiveautomation.ignition.common.gson.Gson
    buildGson(Consumer<com.inductiveautomation.ignition.common.gson.GsonBuilder> builderConsumer)
    Builds a GSON instance with the ImmutableBytes adapter and the RFC 2339 date format set, along with optional customizations.
    decode(Resource resource)
    Default implementation of ResourceCodec.decode(Resource) that decodes the Resource by decoding JSON data from the `config.json` data file.
    decodeFromJson(com.inductiveautomation.ignition.common.gson.JsonElement json)
    Similar to decode(Resource), but decodes the resource's config from a JSON element.
    default R
    Similar to decode(Resource), but reads the resource's config from a reader which will contain the JSON data of the encoded config object.
    com.inductiveautomation.ignition.common.gson.JsonElement
    encodeToJson(R config)
    Converts a resource config object instance to a JSON representation.

    Methods inherited from interface com.inductiveautomation.ignition.gateway.config.ResourceCodec

    decodeIfValid, encode
  • Method Details

    • encodeToJson

      com.inductiveautomation.ignition.common.gson.JsonElement encodeToJson(R config)
      Converts a resource config object instance to a JSON representation.
      Parameters:
      config - The resource to convert.
      Returns:
      A JSON representation of the resource.
    • decodeFromJson

      R decodeFromJson(com.inductiveautomation.ignition.common.gson.JsonElement json) throws DecodingException
      Similar to decode(Resource), but decodes the resource's config from a JSON element.
      Throws:
      DecodingException
    • decodeFromJson

      default R decodeFromJson(Reader reader) throws DecodingException
      Similar to decode(Resource), but reads the resource's config from a reader which will contain the JSON data of the encoded config object.
      Throws:
      DecodingException
    • decode

      default DecodedResource<R> decode(Resource resource) throws DecodingException
      Default implementation of ResourceCodec.decode(Resource) that decodes the Resource by decoding JSON data from the `config.json` data file.
      Specified by:
      decode in interface ResourceCodec<R>
      Parameters:
      resource - the resource to decode.
      Returns:
      the decoded resource.
      Throws:
      DecodingException - if the resource cannot be decoded.
      See Also:
    • buildGson

      static com.inductiveautomation.ignition.common.gson.Gson buildGson(@Nullable Consumer<com.inductiveautomation.ignition.common.gson.GsonBuilder> builderConsumer)
      Builds a GSON instance with the ImmutableBytes adapter and the RFC 2339 date format set, along with optional customizations.