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 a
TypedValueSerializer for ObjectValues.- Author:
- Daniel Meyer
-
Field Summary
Fields inherited from class org.camunda.bpm.engine.impl.variable.serializer.AbstractSerializableValueSerializer
serializationDataFormatFields inherited from class org.camunda.bpm.engine.impl.variable.serializer.AbstractTypedValueSerializer
BINARY_VALUE_TYPES, valueType -
Constructor Summary
Constructors -
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) protected ObjectValuecreateSerializedValue(String serializedStringValue, ValueFields valueFields, boolean asTransientValue) 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) protected voidwriteToValueFields(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, writeValueMethods inherited from class org.camunda.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.camunda.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) - Specified by:
writeToValueFieldsin classAbstractSerializableValueSerializer<ObjectValue>
-
getObjectTypeName
-
updateTypedValue
- Specified by:
updateTypedValuein classAbstractSerializableValueSerializer<ObjectValue>
-
createDeserializedValue
protected ObjectValue createDeserializedValue(Object deserializedObject, String serializedStringValue, ValueFields valueFields, boolean asTransientValue) - Specified by:
createDeserializedValuein classAbstractSerializableValueSerializer<ObjectValue>
-
createSerializedValue
protected ObjectValue createSerializedValue(String serializedStringValue, ValueFields valueFields, boolean asTransientValue) - Specified by:
createSerializedValuein classAbstractSerializableValueSerializer<ObjectValue>
-
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
- Throws:
exception- in case the object cannot be serializedException
-
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
-
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:
isSerializationTextBasedin classAbstractSerializableValueSerializer<ObjectValue>
-