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 Modifier and Type Field Description protected java.lang.String
serializationDataFormat
-
Fields inherited from class org.camunda.bpm.engine.impl.variable.serializer.AbstractTypedValueSerializer
BINARY_VALUE_TYPES, valueType
-
-
Constructor Summary
Constructors Constructor Description AbstractSerializableValueSerializer(SerializableValueType type, java.lang.String serializationDataFormat)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract boolean
canSerializeValue(java.lang.Object value)
return true if this serializer is able to serialize the provided object.protected boolean
canWriteValue(TypedValue typedValue)
protected abstract T
createDeserializedValue(java.lang.Object deserializedObject, java.lang.String serializedStringValue, ValueFields valueFields, boolean asTransientValue)
protected abstract T
createSerializedValue(java.lang.String serializedStringValue, ValueFields valueFields, boolean asTransientValue)
protected abstract java.lang.Object
deserializeFromByteArray(byte[] object, ValueFields valueFields)
Deserialize the object from a byte array.java.lang.String
getSerializationDataformat()
protected byte[]
getSerializedBytesValue(java.lang.String serializedStringValue)
protected java.lang.String
getSerializedStringValue(byte[] serializedByteValue)
protected abstract boolean
isSerializationTextBased()
Return true if the serialization is text based.protected byte[]
readSerializedValueFromFields(ValueFields valueFields)
T
readValue(ValueFields valueFields, boolean deserializeObjectValue, boolean asTransientValue)
Retrieve aTypedValue
from the providedValueFields
.protected abstract byte[]
serializeToByteArray(java.lang.Object deserializedObject)
Implementations must return a byte[] representation of the provided object.protected abstract void
updateTypedValue(T value, java.lang.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
-
-
-
-
Constructor Detail
-
AbstractSerializableValueSerializer
public AbstractSerializableValueSerializer(SerializableValueType type, java.lang.String serializationDataFormat)
-
-
Method Detail
-
getSerializationDataformat
public java.lang.String 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
public void writeValue(T value, ValueFields valueFields)
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(java.lang.Object deserializedObject, java.lang.String serializedStringValue, ValueFields valueFields, boolean asTransientValue)
-
createSerializedValue
protected abstract T createSerializedValue(java.lang.String serializedStringValue, ValueFields valueFields, boolean asTransientValue)
-
writeToValueFields
protected abstract void writeToValueFields(T value, ValueFields valueFields, byte[] serializedValue)
-
updateTypedValue
protected abstract void updateTypedValue(T value, java.lang.String serializedStringValue)
-
readSerializedValueFromFields
protected byte[] readSerializedValueFromFields(ValueFields valueFields)
-
getSerializedStringValue
protected java.lang.String getSerializedStringValue(byte[] serializedByteValue)
-
getSerializedBytesValue
protected byte[] getSerializedBytesValue(java.lang.String serializedStringValue)
-
canWriteValue
protected boolean canWriteValue(TypedValue typedValue)
- Specified by:
canWriteValue
in classAbstractTypedValueSerializer<T extends SerializableValue>
-
canSerializeValue
protected abstract boolean canSerializeValue(java.lang.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(java.lang.Object deserializedObject) throws java.lang.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 serializedjava.lang.Exception
-
deserializeFromByteArray
protected abstract java.lang.Object deserializeFromByteArray(byte[] object, ValueFields valueFields) throws java.lang.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 deserializedjava.lang.Exception
-
isSerializationTextBased
protected abstract boolean isSerializationTextBased()
Return true if the serialization is text based. Return false otherwise
-
-