Package org.camunda.spin.plugin.impl
Class SpinValueSerializer
- java.lang.Object
-
- org.camunda.bpm.engine.impl.variable.serializer.AbstractTypedValueSerializer<T>
-
- org.camunda.bpm.engine.impl.variable.serializer.AbstractSerializableValueSerializer<SpinValue>
-
- org.camunda.spin.plugin.impl.SpinValueSerializer
-
- All Implemented Interfaces:
TypedValueSerializer<SpinValue>
- Direct Known Subclasses:
JsonValueSerializer
,XmlValueSerializer
public abstract class SpinValueSerializer extends AbstractSerializableValueSerializer<SpinValue>
- Author:
- Roman Smirnov
-
-
Field Summary
Fields Modifier and Type Field Description protected org.camunda.spin.spi.DataFormat<?>
dataFormat
protected String
name
-
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 SpinValueSerializer(SerializableValueType type, org.camunda.spin.spi.DataFormat<?> dataFormat, String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
canSerializeValue(Object value)
return true if this serializer is able to serialize the provided object.protected Object
deserializeFromByteArray(byte[] object, ValueFields valueFields)
Deserialize the object from a byte array.String
getName()
The name of this serializer.protected boolean
isSerializationTextBased()
Return true if the serialization is text based.protected byte[]
serializeToByteArray(Object deserializedObject)
Implementations must return a byte[] representation of the provided object.protected void
updateTypedValue(SpinValue value, String serializedStringValue)
protected void
writeToValueFields(SpinValue value, ValueFields valueFields, byte[] serializedValue)
-
Methods inherited from class org.camunda.bpm.engine.impl.variable.serializer.AbstractSerializableValueSerializer
canWriteValue, createDeserializedValue, createSerializedValue, getSerializationDataformat, getSerializedBytesValue, getSerializedStringValue, readSerializedValueFromFields, readValue, writeValue
-
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
-
-
-
-
Field Detail
-
dataFormat
protected org.camunda.spin.spi.DataFormat<?> dataFormat
-
name
protected String name
-
-
Constructor Detail
-
SpinValueSerializer
public SpinValueSerializer(SerializableValueType type, org.camunda.spin.spi.DataFormat<?> dataFormat, String name)
-
-
Method Detail
-
getName
public String getName()
Description copied from interface:TypedValueSerializer
The name of this serializer. The name is used when persisting the ValueFields populated by this serializer.- Returns:
- the name of this serializer.
-
writeToValueFields
protected void writeToValueFields(SpinValue value, ValueFields valueFields, byte[] serializedValue)
- Specified by:
writeToValueFields
in classAbstractSerializableValueSerializer<SpinValue>
-
updateTypedValue
protected void updateTypedValue(SpinValue value, String serializedStringValue)
- Specified by:
updateTypedValue
in classAbstractSerializableValueSerializer<SpinValue>
-
canSerializeValue
protected boolean canSerializeValue(Object value)
Description copied from class:AbstractSerializableValueSerializer
return true if this serializer is able to serialize the provided object.- Specified by:
canSerializeValue
in classAbstractSerializableValueSerializer<SpinValue>
- Parameters:
value
- the object to test (guaranteed to be a non-null value)- Returns:
- true if the serializer can handle the object.
-
serializeToByteArray
protected byte[] serializeToByteArray(Object deserializedObject) throws Exception
Description copied from class:AbstractSerializableValueSerializer
Implementations must return a byte[] representation of the provided object. The object is guaranteed not to be null.- Specified by:
serializeToByteArray
in classAbstractSerializableValueSerializer<SpinValue>
- Parameters:
deserializedObject
- the object to serialize- Returns:
- the byte array value of the object
- Throws:
Exception
-
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<SpinValue>
- Parameters:
object
- the object to deserializevalueFields
- the value fields- Returns:
- the deserialized object
- Throws:
Exception
-
isSerializationTextBased
protected boolean isSerializationTextBased()
Description copied from class:AbstractSerializableValueSerializer
Return true if the serialization is text based. Return false otherwise- Specified by:
isSerializationTextBased
in classAbstractSerializableValueSerializer<SpinValue>
-
-