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.voidencode(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.JsonElementencodeToJson(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, waitMethods inherited from interface com.inductiveautomation.ignition.gateway.config.JsonResourceCodec
decode, decodeFromJsonMethods inherited from interface com.inductiveautomation.ignition.gateway.config.ResourceCodec
decodeIfValid
-
Constructor Details
-
JsonResourceCodecWrapper
Create a new instance ofJsonResourceCodecWrapper- Parameters:
codec- theJsonResourceCodecinstance to wrap- Throws:
NullPointerException- if the codec argument is null
-
-
Method Details
-
unwrap
- Returns:
- the wrapped
JsonResourceCodec. never null.
-
encodeToJson
Description copied from interface:JsonResourceCodecConverts a resource config object instance to a JSON representation.- Specified by:
encodeToJsonin 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:JsonResourceCodecSimilar toJsonResourceCodec.decode(Resource), but decodes the resource's config from a JSON element.- Specified by:
decodeFromJsonin interfaceJsonResourceCodec<R>- Throws:
DecodingException
-
encode
Description copied from interface:ResourceCodecEncodes a resource's config object, and stores it in the resource in the appropriate location.- Specified by:
encodein interfaceResourceCodec<R>
-