Class AbstractObjectValueSerializer
- java.lang.Object
-
- org.camunda.bpm.engine.impl.variable.serializer.AbstractTypedValueSerializer<T>
-
- org.camunda.bpm.engine.impl.variable.serializer.AbstractSerializableValueSerializer<ObjectValue>
-
- org.camunda.bpm.engine.impl.variable.serializer.AbstractObjectValueSerializer
-
- All Implemented Interfaces:
TypedValueSerializer<ObjectValue>
- Direct Known Subclasses:
FallbackSpinObjectValueSerializer
,JavaObjectSerializer
,SpinObjectValueSerializer
public abstract class AbstractObjectValueSerializer extends AbstractSerializableValueSerializer<ObjectValue>
Abstract implementation of aTypedValueSerializer
forObjectValues
.- Author:
- Daniel Meyer
-
-
Field Summary
-
Fields inherited from class org.camunda.bpm.engine.impl.variable.serializer.AbstractSerializableValueSerializer
serializationDataFormat
-
Fields inherited from class org.camunda.bpm.engine.impl.variable.serializer.AbstractTypedValueSerializer
BINARY_VALUE_TYPES, valueType
-
-
Constructor Summary
Constructors Constructor Description AbstractObjectValueSerializer(java.lang.String serializationDataFormat)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description ObjectValue
convertToTypedValue(UntypedValueImpl untypedValue)
Returns a typed value for the provided untyped value.protected ObjectValue
createDeserializedValue(java.lang.Object deserializedObject, java.lang.String serializedStringValue, ValueFields valueFields, boolean asTransientValue)
protected ObjectValue
createSerializedValue(java.lang.String serializedStringValue, ValueFields valueFields, boolean asTransientValue)
protected abstract java.lang.Object
deserializeFromByteArray(byte[] object, java.lang.String objectTypeName)
Deserialize the object from a byte array.protected java.lang.Object
deserializeFromByteArray(byte[] object, ValueFields valueFields)
Deserialize the object from a byte array.protected java.lang.String
getObjectTypeName(ObjectValue value, ValueFields valueFields)
protected abstract java.lang.String
getTypeNameForDeserialized(java.lang.Object deserializedObject)
Returns the type name for the deserialized object.boolean
isMutableValue(ObjectValue typedValue)
protected abstract boolean
isSerializationTextBased()
Return true if the serialization is text based.protected java.lang.String
readObjectNameFromFields(ValueFields valueFields)
protected abstract byte[]
serializeToByteArray(java.lang.Object deserializedObject)
Implementations must return a byte[] representation of the provided object.protected void
updateTypedValue(ObjectValue value, java.lang.String serializedStringValue)
protected void
writeToValueFields(ObjectValue value, ValueFields valueFields, byte[] serializedValue)
-
Methods inherited from class org.camunda.bpm.engine.impl.variable.serializer.AbstractSerializableValueSerializer
canSerializeValue, canWriteValue, getSerializationDataformat, getSerializedBytesValue, getSerializedStringValue, readSerializedValueFromFields, readValue, writeValue
-
Methods inherited from class org.camunda.bpm.engine.impl.variable.serializer.AbstractTypedValueSerializer
canHandle, getType
-
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
getName
-
-
-
-
Method Detail
-
convertToTypedValue
public ObjectValue convertToTypedValue(UntypedValueImpl untypedValue)
Description copied from interface:TypedValueSerializer
Returns a typed value for the provided untyped value. This is used on cases where the user sets an untyped value which is then detected to be handled by thisTypedValueSerializer
(by invocation ofTypedValueSerializer.canHandle(TypedValue)
).- Parameters:
untypedValue
- the untyped value- Returns:
- the corresponding typed value
-
writeToValueFields
protected void writeToValueFields(ObjectValue value, ValueFields valueFields, byte[] serializedValue)
- Specified by:
writeToValueFields
in classAbstractSerializableValueSerializer<ObjectValue>
-
getObjectTypeName
protected java.lang.String getObjectTypeName(ObjectValue value, ValueFields valueFields)
-
updateTypedValue
protected void updateTypedValue(ObjectValue value, java.lang.String serializedStringValue)
- Specified by:
updateTypedValue
in classAbstractSerializableValueSerializer<ObjectValue>
-
createDeserializedValue
protected ObjectValue createDeserializedValue(java.lang.Object deserializedObject, java.lang.String serializedStringValue, ValueFields valueFields, boolean asTransientValue)
- Specified by:
createDeserializedValue
in classAbstractSerializableValueSerializer<ObjectValue>
-
createSerializedValue
protected ObjectValue createSerializedValue(java.lang.String serializedStringValue, ValueFields valueFields, boolean asTransientValue)
- Specified by:
createSerializedValue
in classAbstractSerializableValueSerializer<ObjectValue>
-
readObjectNameFromFields
protected java.lang.String readObjectNameFromFields(ValueFields valueFields)
-
isMutableValue
public boolean isMutableValue(ObjectValue typedValue)
- Specified by:
isMutableValue
in interfaceTypedValueSerializer<ObjectValue>
- Overrides:
isMutableValue
in classAbstractTypedValueSerializer<ObjectValue>
- Returns:
- whether values serialized by this serializer can be mutable and should be re-serialized if changed
-
getTypeNameForDeserialized
protected abstract java.lang.String getTypeNameForDeserialized(java.lang.Object deserializedObject)
Returns the type name for the deserialized object.- Parameters:
deserializedObject
- . Guaranteed not to be null- Returns:
- the type name fot 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.- Specified by:
serializeToByteArray
in classAbstractSerializableValueSerializer<ObjectValue>
- 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 java.lang.Object deserializeFromByteArray(byte[] object, ValueFields valueFields) throws java.lang.Exception
Description copied from class:AbstractSerializableValueSerializer
Deserialize the object from a byte array.- Specified by:
deserializeFromByteArray
in classAbstractSerializableValueSerializer<ObjectValue>
- Parameters:
object
- the object to deserializevalueFields
- the value fields- Returns:
- the deserialized object
- Throws:
java.lang.Exception
-
deserializeFromByteArray
protected abstract java.lang.Object deserializeFromByteArray(byte[] object, java.lang.String objectTypeName) throws java.lang.Exception
Deserialize the object from a byte array.- Parameters:
object
- the object to deserializeobjectTypeName
- the type name of the object to deserialize- 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- Specified by:
isSerializationTextBased
in classAbstractSerializableValueSerializer<ObjectValue>
-
-