public abstract class AbstractObjectValueSerializer extends AbstractTypedValueSerializer<ObjectValue>
TypedValueSerializer
for ObjectValues
.Modifier and Type | Field and Description |
---|---|
protected String |
serializationDataFormat |
valueType
Constructor and Description |
---|
AbstractObjectValueSerializer(String serializationDataFormat) |
Modifier and Type | Method and Description |
---|---|
protected abstract boolean |
canSerializeObject(Object value)
return true if this serializer is able to serialize the provided object.
|
protected boolean |
canWriteValue(TypedValue typedValue) |
ObjectValue |
convertToTypedValue(UntypedValueImpl untypedValue)
Returns a typed value for the provided untyped value.
|
protected abstract Object |
deserializeFromByteArray(byte[] object,
String objectTypeName)
Deserialize the object from a byte array.
|
String |
getSerializationDataformat() |
protected byte[] |
getSerializedBytesValue(String serializedStringValue) |
protected String |
getSerializedStringValue(byte[] serializedByteValue) |
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 byte[] |
readSerializedValueFromFields(ValueFields valueFields) |
ObjectValue |
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 void |
updateObjectValue(ObjectValueImpl objectValue,
String objectTypeName,
String serializedValue) |
protected void |
writeToValueFields(ValueFields valueFields,
String objectTypeName,
byte[] serializedValue) |
void |
writeValue(ObjectValue value,
ValueFields valueFields)
Serialize a
TypedValue to the ValueFields . |
canHandle, getType
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getName
protected String serializationDataFormat
public AbstractObjectValueSerializer(String serializationDataFormat)
public String getSerializationDataformat()
getSerializationDataformat
in interface TypedValueSerializer<ObjectValue>
getSerializationDataformat
in class AbstractTypedValueSerializer<ObjectValue>
public ObjectValue convertToTypedValue(UntypedValueImpl untypedValue)
TypedValueSerializer
TypedValueSerializer
(by invocation of TypedValueSerializer.canHandle(TypedValue)
).untypedValue
- the untyped valuepublic void writeValue(ObjectValue value, ValueFields valueFields)
TypedValueSerializer
TypedValue
to the ValueFields
.value
- the TypedValue
to persistvalueFields
- the ValueFields
to which the value should be persistedpublic ObjectValue readValue(ValueFields valueFields, boolean deserializeObjectValue)
TypedValueSerializer
TypedValue
from the provided ValueFields
.valueFields
- the ValueFields
to retrieve the value fromdeserializeObjectValue
- indicates whether a SerializableValue
should be deserialized.TypedValue
protected void writeToValueFields(ValueFields valueFields, String objectTypeName, byte[] serializedValue)
protected void updateObjectValue(ObjectValueImpl objectValue, String objectTypeName, String serializedValue)
protected String readObjectNameFromFields(ValueFields valueFields)
protected byte[] readSerializedValueFromFields(ValueFields valueFields)
protected String getSerializedStringValue(byte[] serializedByteValue)
protected byte[] getSerializedBytesValue(String serializedStringValue)
protected boolean canWriteValue(TypedValue typedValue)
canWriteValue
in class AbstractTypedValueSerializer<ObjectValue>
public boolean isMutableValue(ObjectValue typedValue)
isMutableValue
in interface TypedValueSerializer<ObjectValue>
isMutableValue
in class AbstractTypedValueSerializer<ObjectValue>
protected abstract boolean canSerializeObject(Object value)
value
- the object to test (guaranteed to be a non-null value)protected abstract String getTypeNameForDeserialized(Object deserializedObject)
deserializedObject.
- Guaranteed not to be nullprotected abstract byte[] serializeToByteArray(Object deserializedObject) throws Exception
deserializedObject
- the object to serializeexception
- in case the object cannot be serializedException
protected abstract Object deserializeFromByteArray(byte[] object, String objectTypeName) throws Exception
object
- the object to deserializeobjectTypeName
- the type name of the object to deserializeexception
- in case the object cannot be deserializedException
protected abstract boolean isSerializationTextBased()
Copyright © 2018. All rights reserved.