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 Summary
Fields inherited from class org.camunda.bpm.engine.impl.variable.serializer.AbstractTypedValueSerializer
BINARY_VALUE_TYPES, valueType
-
Constructor Summary
ConstructorDescriptionAbstractSerializableValueSerializer
(SerializableValueType type, String serializationDataFormat) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract boolean
canSerializeValue
(Object value) return true if this serializer is able to serialize the provided object.protected boolean
canWriteValue
(TypedValue typedValue) protected abstract T
createDeserializedValue
(Object deserializedObject, String serializedStringValue, ValueFields valueFields, boolean asTransientValue) protected abstract T
createSerializedValue
(String serializedStringValue, ValueFields valueFields, boolean asTransientValue) protected abstract Object
deserializeFromByteArray
(byte[] object, ValueFields valueFields) Deserialize the object from a byte array.protected byte[]
getSerializedBytesValue
(String serializedStringValue) protected String
getSerializedStringValue
(byte[] serializedByteValue) protected abstract boolean
Return true if the serialization is text based.protected byte[]
readSerializedValueFromFields
(ValueFields valueFields) readValue
(ValueFields valueFields, boolean deserializeObjectValue, boolean asTransientValue) Retrieve aTypedValue
from the providedValueFields
.protected abstract byte[]
serializeToByteArray
(Object deserializedObject) Implementations must return a byte[] representation of the provided object.protected abstract void
updateTypedValue
(T value, String serializedStringValue) protected abstract void
writeToValueFields
(T value, ValueFields valueFields, byte[] serializedValue) void
writeValue
(T value, ValueFields valueFields) Serialize aTypedValue
to theValueFields
.Methods inherited from class org.camunda.bpm.engine.impl.variable.serializer.AbstractTypedValueSerializer
canHandle, getType, isMutableValue
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.camunda.bpm.engine.impl.variable.serializer.TypedValueSerializer
convertToTypedValue, getName
-
Field Details
-
serializationDataFormat
-
-
Constructor Details
-
AbstractSerializableValueSerializer
public AbstractSerializableValueSerializer(SerializableValueType type, String serializationDataFormat)
-
-
Method Details
-
getSerializationDataformat
- Specified by:
getSerializationDataformat
in interfaceTypedValueSerializer<T extends SerializableValue>
- Overrides:
getSerializationDataformat
in classAbstractTypedValueSerializer<T extends SerializableValue>
- Returns:
- the dataformat used by the serializer or null if this is not an object serializer
-
writeValue
Description copied from interface:TypedValueSerializer
Serialize aTypedValue
to theValueFields
.- Parameters:
value
- theTypedValue
to persistvalueFields
- theValueFields
to which the value should be persisted
-
readValue
public T readValue(ValueFields valueFields, boolean deserializeObjectValue, boolean asTransientValue) Description copied from interface:TypedValueSerializer
Retrieve aTypedValue
from the providedValueFields
.- Parameters:
valueFields
- theValueFields
to retrieve the value fromdeserializeObjectValue
- indicates whether aSerializableValue
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
-
readSerializedValueFromFields
-
getSerializedStringValue
-
getSerializedBytesValue
-
canWriteValue
- Specified by:
canWriteValue
in classAbstractTypedValueSerializer<T extends SerializableValue>
-
canSerializeValue
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
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 serializedException
-
deserializeFromByteArray
protected abstract Object deserializeFromByteArray(byte[] object, ValueFields valueFields) throws Exception Deserialize the object from a byte array.- Parameters:
object
- the object to deserializevalueFields
- the value fields- Returns:
- the deserialized object
- Throws:
exception
- in case the object cannot be deserializedException
-
isSerializationTextBased
protected abstract boolean isSerializationTextBased()Return true if the serialization is text based. Return false otherwise
-