Class AbstractSerializableValueSerializer<T extends SerializableValue>

java.lang.Object
org.camunda.bpm.engine.impl.variable.serializer.AbstractTypedValueSerializer<T>
org.camunda.bpm.engine.impl.variable.serializer.AbstractSerializableValueSerializer<T>
All Implemented Interfaces:
TypedValueSerializer<T>
Direct Known Subclasses:
AbstractObjectValueSerializer, SpinValueSerializer

public abstract class AbstractSerializableValueSerializer<T extends SerializableValue> extends AbstractTypedValueSerializer<T>
Author:
Roman Smirnov
  • Field Details

    • serializationDataFormat

      protected String serializationDataFormat
  • Constructor Details

    • AbstractSerializableValueSerializer

      public AbstractSerializableValueSerializer(SerializableValueType type, String serializationDataFormat)
  • Method Details

    • getSerializationDataformat

      public String getSerializationDataformat()
      Specified by:
      getSerializationDataformat in interface TypedValueSerializer<T extends SerializableValue>
      Overrides:
      getSerializationDataformat in class AbstractTypedValueSerializer<T extends SerializableValue>
      Returns:
      the dataformat used by the serializer or null if this is not an object serializer
    • writeValue

      public void writeValue(T value, ValueFields valueFields)
      Description copied from interface: TypedValueSerializer
      Serialize a TypedValue to the ValueFields.
      Parameters:
      value - the TypedValue to persist
      valueFields - the ValueFields to which the value should be persisted
    • readValue

      public T readValue(ValueFields valueFields, boolean deserializeObjectValue, boolean asTransientValue)
      Description copied from interface: TypedValueSerializer
      Retrieve a TypedValue from the provided ValueFields.
      Parameters:
      valueFields - the ValueFields to retrieve the value from
      deserializeObjectValue - indicates whether a SerializableValue should be deserialized.
      Returns:
      the TypedValue
    • createDeserializedValue

      protected abstract T createDeserializedValue(Object deserializedObject, String serializedStringValue, ValueFields valueFields, boolean asTransientValue)
    • createSerializedValue

      protected abstract T createSerializedValue(String serializedStringValue, ValueFields valueFields, boolean asTransientValue)
    • writeToValueFields

      protected abstract void writeToValueFields(T value, ValueFields valueFields, byte[] serializedValue)
    • updateTypedValue

      protected abstract void updateTypedValue(T value, String serializedStringValue)
    • readSerializedValueFromFields

      protected byte[] readSerializedValueFromFields(ValueFields valueFields)
    • getSerializedStringValue

      protected String getSerializedStringValue(byte[] serializedByteValue)
    • getSerializedBytesValue

      protected byte[] getSerializedBytesValue(String serializedStringValue)
    • canWriteValue

      protected boolean canWriteValue(TypedValue typedValue)
      Specified by:
      canWriteValue in class AbstractTypedValueSerializer<T extends SerializableValue>
    • canSerializeValue

      protected abstract boolean canSerializeValue(Object value)
      return true if this serializer is able to serialize the provided object.
      Parameters:
      value - the object to test (guaranteed to be a non-null value)
      Returns:
      true if the serializer can handle the object.
    • serializeToByteArray

      protected abstract byte[] serializeToByteArray(Object deserializedObject) throws Exception
      Implementations must return a byte[] representation of the provided object. The object is guaranteed not to be null.
      Parameters:
      deserializedObject - the object to serialize
      Returns:
      the byte array value of the object
      Throws:
      exception - in case the object cannot be serialized
      Exception
    • deserializeFromByteArray

      protected abstract Object deserializeFromByteArray(byte[] object, ValueFields valueFields) throws Exception
      Deserialize the object from a byte array.
      Parameters:
      object - the object to deserialize
      valueFields - the value fields
      Returns:
      the deserialized object
      Throws:
      exception - in case the object cannot be deserialized
      Exception
    • isSerializationTextBased

      protected abstract boolean isSerializationTextBased()
      Return true if the serialization is text based. Return false otherwise