Class StringSerialiser
- java.lang.Object
-
- uk.gov.gchq.gaffer.serialisation.ToBytesViaStringDeserialiser<String>
-
- uk.gov.gchq.gaffer.serialisation.implementation.StringSerialiser
-
- All Implemented Interfaces:
Serializable
,Serialiser<String,byte[]>
,ToBytesSerialiser<String>
public class StringSerialiser extends ToBytesViaStringDeserialiser<String>
AStringSerialiser
is used to serialiseString
s.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from interface uk.gov.gchq.gaffer.serialisation.ToBytesSerialiser
EMPTY_BYTES
-
-
Constructor Summary
Constructors Constructor Description StringSerialiser()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canHandle(Class clazz)
Check whether the serialiser can serialise a particular class.String
deserialiseEmpty()
Handle an empty byte array and reconstruct an appropriate representation in T form.boolean
equals(Object obj)
int
hashCode()
boolean
isConsistent()
Indicates whether the serialisation process produces a predictable, consistent OUTPUT, from a given INPUT, ie the same object should always serialise in the same way for this to be true.boolean
preservesObjectOrdering()
Indicates whether the serialisation process preserves the ordering of the T, i.e.-
Methods inherited from class uk.gov.gchq.gaffer.serialisation.ToBytesViaStringDeserialiser
deserialise, deserialise, getCharset, serialise, setCharset
-
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface uk.gov.gchq.gaffer.serialisation.ToBytesSerialiser
serialiseNull
-
-
-
-
Method Detail
-
canHandle
public boolean canHandle(Class clazz)
Description copied from interface:Serialiser
Check whether the serialiser can serialise a particular class.//Warning: Due to erasure you may get false positives. e.g.
Set<Foo> set = Sets.newHashSet(); boolean b = new Serialiser<Set<Bar>, byte[]>().canHandle(set.getClass()); b will incorrectly be true because of type erasure between Set<Foo> Set<Bar>
- Parameters:
clazz
- the object class to serialise- Returns:
- boolean true if it can be handled
-
deserialiseEmpty
public String deserialiseEmpty()
Description copied from interface:ToBytesSerialiser
Handle an empty byte array and reconstruct an appropriate representation in T form.- Returns:
- T the deserialised object
-
preservesObjectOrdering
public boolean preservesObjectOrdering()
Description copied from interface:ToBytesSerialiser
Indicates whether the serialisation process preserves the ordering of the T, i.e. if x and y are objects of class T, and x is less than y, then this method should return true if the serialised form of x is guaranteed to be less than the serialised form of y (using the standard ordering of byte arrays). If T is not Comparable then this test makes no sense and false should be returned.- Returns:
- true if the serialisation will preserve the order of the T, otherwise false.
-
isConsistent
public boolean isConsistent()
Description copied from interface:Serialiser
Indicates whether the serialisation process produces a predictable, consistent OUTPUT, from a given INPUT, ie the same object should always serialise in the same way for this to be true.- Returns:
- true if serialisation is consistent for a given object, otherwise false.
-
-