org.camunda.bpm.engine.impl.variable.serializer
Class AbstractSerializableValueSerializer<T extends org.camunda.bpm.engine.variable.value.SerializableValue>

java.lang.Object
  extended by org.camunda.bpm.engine.impl.variable.serializer.AbstractTypedValueSerializer<T>
      extended by org.camunda.bpm.engine.impl.variable.serializer.AbstractSerializableValueSerializer<T>
All Implemented Interfaces:
TypedValueSerializer<T>
Direct Known Subclasses:
AbstractObjectValueSerializer

public abstract class AbstractSerializableValueSerializer<T extends org.camunda.bpm.engine.variable.value.SerializableValue>
extends AbstractTypedValueSerializer<T>

Author:
Roman Smirnov

Field Summary
protected  String serializationDataFormat
           
 
Fields inherited from class org.camunda.bpm.engine.impl.variable.serializer.AbstractTypedValueSerializer
BINARY_VALUE_TYPES, valueType
 
Constructor Summary
AbstractSerializableValueSerializer(org.camunda.bpm.engine.variable.type.SerializableValueType type, String serializationDataFormat)
           
 
Method Summary
protected abstract  boolean canSerializeValue(Object value)
          return true if this serializer is able to serialize the provided object.
protected  boolean canWriteValue(org.camunda.bpm.engine.variable.value.TypedValue typedValue)
           
protected abstract  T createDeserializedValue(Object deserializedObject, String serializedStringValue, ValueFields valueFields)
           
protected abstract  T createSerializedValue(String serializedStringValue, ValueFields valueFields)
           
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)
          Retrieve a TypedValue from the provided ValueFields.
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 a TypedValue to the ValueFields.
 
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(org.camunda.bpm.engine.variable.type.SerializableValueType type,
                                           String serializationDataFormat)
Method Detail

getSerializationDataformat

public String getSerializationDataformat()
Specified by:
getSerializationDataformat in interface TypedValueSerializer<T extends org.camunda.bpm.engine.variable.value.SerializableValue>
Overrides:
getSerializationDataformat in class AbstractTypedValueSerializer<T extends org.camunda.bpm.engine.variable.value.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 a TypedValue to the ValueFields.

Parameters:
value - the TypedValue to persist
valueFields - the ValueFields to which the value should be persisted

readValue

public T readValue(ValueFields valueFields,
                   boolean deserializeObjectValue)
Description copied from interface: TypedValueSerializer
Retrieve a TypedValue from the provided ValueFields.

Parameters:
valueFields - the ValueFields to retrieve the value from
deserializeObjectValue - indicates whether a SerializableValue should be deserialized.
Returns:
the TypedValue

createDeserializedValue

protected abstract T createDeserializedValue(Object deserializedObject,
                                             String serializedStringValue,
                                             ValueFields valueFields)

createSerializedValue

protected abstract T createSerializedValue(String serializedStringValue,
                                           ValueFields valueFields)

writeToValueFields

protected abstract void writeToValueFields(T value,
                                           ValueFields valueFields,
                                           byte[] serializedValue)

updateTypedValue

protected abstract void updateTypedValue(T value,
                                         String serializedStringValue)

readSerializedValueFromFields

protected byte[] readSerializedValueFromFields(ValueFields valueFields)

getSerializedStringValue

protected String getSerializedStringValue(byte[] serializedByteValue)

getSerializedBytesValue

protected byte[] getSerializedBytesValue(String serializedStringValue)

canWriteValue

protected boolean canWriteValue(org.camunda.bpm.engine.variable.value.TypedValue typedValue)
Specified by:
canWriteValue in class AbstractTypedValueSerializer<T extends org.camunda.bpm.engine.variable.value.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 serialized
Exception

deserializeFromByteArray

protected abstract Object deserializeFromByteArray(byte[] object,
                                                   ValueFields valueFields)
                                            throws Exception
Deserialize the object from a byte array.

Parameters:
object - the object to deserialize
valueFields - the value fields
Returns:
the deserialized object
Throws:
exception - in case the object cannot be deserialized
Exception

isSerializationTextBased

protected abstract boolean isSerializationTextBased()
Return true if the serialization is text based. Return false otherwise



Copyright © 2016 camunda services GmbH. All rights reserved.