Interface JsonResourceCodec<R>
- All Superinterfaces:
ResourceCodec<R>
- All Known Implementing Classes:
ExtensionPointResourceCodec, GsonResourceCodec, JsonResourceCodecWrapper
-
Method Summary
Modifier and TypeMethodDescriptionstatic com.inductiveautomation.ignition.common.gson.GsonbuildGson(@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.default DecodedResource<R> Default implementation ofResourceCodec.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 todecode(Resource), but decodes the resource's config from a JSON element.default RdecodeFromJson(Reader reader) Similar todecode(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.JsonElementencodeToJson(R config) Converts a resource config object instance to a JSON representation.Methods inherited from interface ResourceCodec
decodeIfValid, encode, encode
-
Method Details
-
encodeToJson
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 todecode(Resource), but decodes the resource's config from a JSON element.- Throws:
DecodingException
-
decodeFromJson
Similar todecode(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 implementation ofResourceCodec.decode(Resource)that decodes the Resource by decoding JSON data from the `config.json` data file.- Specified by:
decodein interfaceResourceCodec<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.
-