Class JsonResourceCodecWrapper<R>
java.lang.Object
com.inductiveautomation.ignition.gateway.config.JsonResourceCodecWrapper<R>
- Type Parameters:
R
- the resource config type
- All Implemented Interfaces:
JsonResourceCodec<R>
,ResourceCodec<R>
Basic wrapper around a
JsonResourceCodec
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondecodeFromJson
(com.inductiveautomation.ignition.common.gson.JsonElement json) Similar toJsonResourceCodec.decode(Resource)
, but decodes the resource's config from a JSON element.void
encode
(R config, ResourceBuilder builder) Encodes a resource's config object, and stores it in the resource in the appropriate location.com.inductiveautomation.ignition.common.gson.JsonElement
encodeToJson
(R config) Converts a resource config object instance to a JSON representation.unwrap()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.inductiveautomation.ignition.gateway.config.JsonResourceCodec
decode, decodeFromJson
Methods inherited from interface com.inductiveautomation.ignition.gateway.config.ResourceCodec
decodeIfValid
-
Constructor Details
-
JsonResourceCodecWrapper
Create a new instance ofJsonResourceCodecWrapper
- Parameters:
codec
- theJsonResourceCodec
instance to wrap- Throws:
NullPointerException
- if the codec argument is null
-
-
Method Details
-
unwrap
- Returns:
- the wrapped
JsonResourceCodec
. never null.
-
encodeToJson
Description copied from interface:JsonResourceCodec
Converts a resource config object instance to a JSON representation.- Specified by:
encodeToJson
in interfaceJsonResourceCodec<R>
- Parameters:
config
- The resource to convert.- Returns:
- A JSON representation of the resource.
-
decodeFromJson
public R decodeFromJson(com.inductiveautomation.ignition.common.gson.JsonElement json) throws DecodingException Description copied from interface:JsonResourceCodec
Similar toJsonResourceCodec.decode(Resource)
, but decodes the resource's config from a JSON element.- Specified by:
decodeFromJson
in interfaceJsonResourceCodec<R>
- Throws:
DecodingException
-
encode
Description copied from interface:ResourceCodec
Encodes a resource's config object, and stores it in the resource in the appropriate location.- Specified by:
encode
in interfaceResourceCodec<R>
-