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(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(Object deserializedObject, String serializedStringValue, ValueFields valueFields, boolean asTransientValue)
protected ObjectValue
createSerializedValue(String serializedStringValue, ValueFields valueFields, boolean asTransientValue)
protected abstract Object
deserializeFromByteArray(byte[] object, String objectTypeName)
Deserialize the object from a byte array.protected Object
deserializeFromByteArray(byte[] object, ValueFields valueFields)
Deserialize the object from a byte array.protected String
getObjectTypeName(ObjectValue value, ValueFields valueFields)
protected abstract String
getTypeNameForDeserialized(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 String
readObjectNameFromFields(ValueFields valueFields)
protected abstract byte[]
serializeToByteArray(Object deserializedObject)
Implementations must return a byte[] representation of the provided object.protected void
updateTypedValue(ObjectValue value, 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
-
-
-
-
Constructor Detail
-
AbstractObjectValueSerializer
public AbstractObjectValueSerializer(String serializationDataFormat)
-
-
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 String getObjectTypeName(ObjectValue value, ValueFields valueFields)
-
updateTypedValue
protected void updateTypedValue(ObjectValue value, String serializedStringValue)
- Specified by:
updateTypedValue
in classAbstractSerializableValueSerializer<ObjectValue>
-
createDeserializedValue
protected ObjectValue createDeserializedValue(Object deserializedObject, String serializedStringValue, ValueFields valueFields, boolean asTransientValue)
- Specified by:
createDeserializedValue
in classAbstractSerializableValueSerializer<ObjectValue>
-
createSerializedValue
protected ObjectValue createSerializedValue(String serializedStringValue, ValueFields valueFields, boolean asTransientValue)
- Specified by:
createSerializedValue
in classAbstractSerializableValueSerializer<ObjectValue>
-
readObjectNameFromFields
protected 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 String getTypeNameForDeserialized(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(Object deserializedObject) throws 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 serializedException
-
deserializeFromByteArray
protected Object deserializeFromByteArray(byte[] object, ValueFields valueFields) throws 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:
Exception
-
deserializeFromByteArray
protected abstract Object deserializeFromByteArray(byte[] object, String objectTypeName) throws 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 deserializedException
-
isSerializationTextBased
protected abstract boolean isSerializationTextBased()
Return true if the serialization is text based. Return false otherwise- Specified by:
isSerializationTextBased
in classAbstractSerializableValueSerializer<ObjectValue>
-
-