Class AbstractPointSerializer<T extends PersistentPoint, S extends com.google.protobuf.Message>
java.lang.Object
com.inductiveautomation.historian.gateway.api.storeforward.serialization.AbstractPointSerializer<T,S>
- Type Parameters:
T- the carrier typeS- the protobuf batch message typeTmaps to
- All Implemented Interfaces:
PersistentSerializer<T,S>
- Direct Known Subclasses:
PersistentAtomicPointSerializer, PersistentChangePointSerializer, PersistentComplexPointSerializer
public abstract class AbstractPointSerializer<T extends PersistentPoint, S extends com.google.protobuf.Message>
extends Object
implements PersistentSerializer<T,S>
Shared
PersistentSerializer plumbing for the temporal-point batch carriers (
PersistentAtomicPoint, PersistentComplexPoint, PersistentChangePoint). The proto
and JSON forms derive from the binary form, so a subclass supplies only the binary PersistentSerializer.toBytes(T, SerializationContext)/PersistentSerializer.fromBytes(byte[], DeserializationContext) translation, and the constructor takes the proto message's Parser and builder factory.- Since:
- 2027.02
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractPointSerializer(com.google.protobuf.Parser<S> parser, Supplier<com.google.protobuf.Message.Builder> builderFactory) -
Method Summary
Modifier and TypeMethodDescriptionfromJson(String json, @Nullable DeserializationContext context) Deserializes the given JSON string into a TPersistentDataobject.fromJsonElement(com.inductiveautomation.ignition.common.gson.JsonElement jsonElement, @Nullable DeserializationContext context) Deserializes the givenJsonElementinto a TPersistentDataobject.fromProtoMessage(S message, @Nullable DeserializationContext context) Deserializes the given ProtobufMessageinto a TPersistentDataobject.toJson(T data, @Nullable SerializationContext context) Serializes the given TPersistentDatainto a JSON string.com.inductiveautomation.ignition.common.gson.JsonElementtoJsonElement(T data, @Nullable SerializationContext context) Serializes the given TPersistentDatainto aJsonElement.toProtoMessage(T data, @Nullable SerializationContext context) Serializes the given TPersistentDatainto a ProtobufMessage.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface PersistentSerializer
fromBytes, getCompatibleClass, toBytes
-
Constructor Details
-
AbstractPointSerializer
-
-
Method Details
-
toProtoMessage
Description copied from interface:PersistentSerializerSerializes the given TPersistentDatainto a ProtobufMessage.- Specified by:
toProtoMessagein interfacePersistentSerializer<T extends PersistentPoint, S extends com.google.protobuf.Message>- Parameters:
data- The TPersistentDatato serialize.context- The serialization context to use for serialization.- Returns:
- The serialized data as an S
Message. - Throws:
SerializeException- If an error occurs during serialization.
-
toJson
Description copied from interface:PersistentSerializerSerializes the given TPersistentDatainto a JSON string.- Specified by:
toJsonin interfacePersistentSerializer<T extends PersistentPoint, S extends com.google.protobuf.Message>- Parameters:
data- The TPersistentDatato serialize.context- The serialization context to use for serialization.- Returns:
- The serialized data as a JSON string.
- Throws:
SerializeException- If an error occurs during serialization.
-
toJsonElement
public com.inductiveautomation.ignition.common.gson.JsonElement toJsonElement(T data, @Nullable SerializationContext context) throws SerializeException Description copied from interface:PersistentSerializerSerializes the given TPersistentDatainto aJsonElement.- Specified by:
toJsonElementin interfacePersistentSerializer<T extends PersistentPoint, S extends com.google.protobuf.Message>- Parameters:
data- The TPersistentDatato serialize.context- The serialization context to use for serialization.- Returns:
- The serialized data as a
JsonElement. - Throws:
SerializeException- If an error occurs during serialization.
-
fromProtoMessage
public T fromProtoMessage(S message, @Nullable DeserializationContext context) throws DeserializeException Description copied from interface:PersistentSerializerDeserializes the given ProtobufMessageinto a TPersistentDataobject.- Specified by:
fromProtoMessagein interfacePersistentSerializer<T extends PersistentPoint, S extends com.google.protobuf.Message>- Parameters:
message- The S ProtobufMessageto deserialize.context- The deserialization context to use for deserialization.- Returns:
- The deserialized persistent data object.
- Throws:
DeserializeException- If an error occurs during deserialization.
-
fromJson
public T fromJson(String json, @Nullable DeserializationContext context) throws DeserializeException Description copied from interface:PersistentSerializerDeserializes the given JSON string into a TPersistentDataobject.- Specified by:
fromJsonin interfacePersistentSerializer<T extends PersistentPoint, S extends com.google.protobuf.Message>- Parameters:
json- The JSON string to deserialize.context- The deserialization context to use for deserialization.- Returns:
- The deserialized persistent data object.
- Throws:
DeserializeException- If an error occurs during deserialization.
-
fromJsonElement
public T fromJsonElement(com.inductiveautomation.ignition.common.gson.JsonElement jsonElement, @Nullable DeserializationContext context) throws DeserializeException Description copied from interface:PersistentSerializerDeserializes the givenJsonElementinto a TPersistentDataobject.- Specified by:
fromJsonElementin interfacePersistentSerializer<T extends PersistentPoint, S extends com.google.protobuf.Message>- Parameters:
jsonElement- TheJsonElementto deserialize.context- The deserialization context to use for deserialization.- Returns:
- The deserialized persistent data object.
- Throws:
DeserializeException- If an error occurs during deserialization.
-