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 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, String serializationDataFormat)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected 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.String
getSerializationDataformat()
protected byte[]
getSerializedBytesValue(String serializedStringValue)
protected 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(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 Detail
-
serializationDataFormat
protected String serializationDataFormat
-
-
Constructor Detail
-
AbstractSerializableValueSerializer
public AbstractSerializableValueSerializer(SerializableValueType type, String serializationDataFormat)
-
-
Method Detail
-
getSerializationDataformat
public 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(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)
-
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 classAbstractTypedValueSerializer<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 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
-
-