Class AbstractObjectValueSerializer
java.lang.Object
org.operaton.bpm.engine.impl.variable.serializer.AbstractTypedValueSerializer<ObjectValue>
org.operaton.bpm.engine.impl.variable.serializer.AbstractSerializableValueSerializer<ObjectValue>
org.operaton.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 a
TypedValueSerializer for ObjectValues.- Author:
- Daniel Meyer
-
Field Summary
Fields inherited from class org.operaton.bpm.engine.impl.variable.serializer.AbstractSerializableValueSerializer
serializationDataFormatFields inherited from class org.operaton.bpm.engine.impl.variable.serializer.AbstractTypedValueSerializer
BINARY_VALUE_TYPES, valueType -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractObjectValueSerializer(String serializationDataFormat) -
Method Summary
Modifier and TypeMethodDescriptionconvertToTypedValue(UntypedValueImpl untypedValue) Returns a typed value for the provided untyped value.protected ObjectValuecreateDeserializedValue(Object deserializedObject, String serializedStringValue, ValueFields valueFields, boolean asTransientValue) Creates a deserialized value from the given parameters.protected ObjectValuecreateSerializedValue(String serializedStringValue, ValueFields valueFields, boolean asTransientValue) Creates a serialized value from the given parameters.protected abstract ObjectdeserializeFromByteArray(byte[] object, String objectTypeName) Deserialize the object from a byte array.protected ObjectdeserializeFromByteArray(byte[] object, ValueFields valueFields) Deserialize the object from a byte array.protected StringgetObjectTypeName(ObjectValue value, ValueFields valueFields) protected abstract StringgetTypeNameForDeserialized(Object deserializedObject) Returns the type name for the deserialized object.booleanisMutableValue(ObjectValue typedValue) protected abstract booleanReturn true if the serialization is text based.protected StringreadObjectNameFromFields(ValueFields valueFields) protected abstract byte[]serializeToByteArray(Object deserializedObject) Implementations must return a byte[] representation of the provided object.protected voidupdateTypedValue(ObjectValue value, String serializedStringValue) Updates the typed value with the serialized string representation.protected voidwriteToValueFields(ObjectValue value, ValueFields valueFields, byte[] serializedValue) Writes the serialized value to the provided value fields.Methods inherited from class org.operaton.bpm.engine.impl.variable.serializer.AbstractSerializableValueSerializer
canSerializeValue, canWriteValue, getSerializationDataformat, getSerializedBytesValue, getSerializedStringValue, readSerializedValueFromFields, readValue, writeValueMethods inherited from class org.operaton.bpm.engine.impl.variable.serializer.AbstractTypedValueSerializer
canHandle, getTypeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.operaton.bpm.engine.impl.variable.serializer.TypedValueSerializer
getName
-
Constructor Details
-
AbstractObjectValueSerializer
-
-
Method Details
-
convertToTypedValue
Description copied from interface:TypedValueSerializerReturns 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) Description copied from class:AbstractSerializableValueSerializerWrites the serialized value to the provided value fields.- Specified by:
writeToValueFieldsin classAbstractSerializableValueSerializer<ObjectValue>- Parameters:
value- the value to writevalueFields- the fields to write toserializedValue- the serialized value as a byte array
-
getObjectTypeName
-
updateTypedValue
Description copied from class:AbstractSerializableValueSerializerUpdates the typed value with the serialized string representation.- Specified by:
updateTypedValuein classAbstractSerializableValueSerializer<ObjectValue>- Parameters:
value- the typed value to updateserializedStringValue- the serialized string representation
-
createDeserializedValue
protected ObjectValue createDeserializedValue(Object deserializedObject, String serializedStringValue, ValueFields valueFields, boolean asTransientValue) Description copied from class:AbstractSerializableValueSerializerCreates a deserialized value from the given parameters.- Specified by:
createDeserializedValuein classAbstractSerializableValueSerializer<ObjectValue>- Parameters:
deserializedObject- the deserialized objectserializedStringValue- the serialized string representationvalueFields- the value fieldsasTransientValue- whether the value is transient- Returns:
- the deserialized value
-
createSerializedValue
protected ObjectValue createSerializedValue(String serializedStringValue, ValueFields valueFields, boolean asTransientValue) Description copied from class:AbstractSerializableValueSerializerCreates a serialized value from the given parameters.- Specified by:
createSerializedValuein classAbstractSerializableValueSerializer<ObjectValue>- Parameters:
serializedStringValue- the serialized string representationvalueFields- the value fieldsasTransientValue- whether the value is transient- Returns:
- the serialized value
-
readObjectNameFromFields
-
isMutableValue
- Specified by:
isMutableValuein interfaceTypedValueSerializer<ObjectValue>- Overrides:
isMutableValuein classAbstractTypedValueSerializer<ObjectValue>- Returns:
- whether values serialized by this serializer can be mutable and should be re-serialized if changed
-
getTypeNameForDeserialized
Returns the type name for the deserialized object.- Parameters:
deserializedObject- . Guaranteed not to be null- Returns:
- the type name fot the object.
-
serializeToByteArray
Implementations must return a byte[] representation of the provided object. The object is guaranteed not to be null.- Specified by:
serializeToByteArrayin classAbstractSerializableValueSerializer<ObjectValue>- Parameters:
deserializedObject- the object to serialize- Returns:
- the byte array value of the object
-
deserializeFromByteArray
Description copied from class:AbstractSerializableValueSerializerDeserialize the object from a byte array.- Specified by:
deserializeFromByteArrayin classAbstractSerializableValueSerializer<ObjectValue>- Parameters:
object- the object to deserializevalueFields- the value fields- Returns:
- the deserialized object
- Throws:
Exception- in case the object cannot be deserialized
-
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
-
isSerializationTextBased
protected abstract boolean isSerializationTextBased()Return true if the serialization is text based. Return false otherwise- Specified by:
isSerializationTextBasedin classAbstractSerializableValueSerializer<ObjectValue>
-