Class KeySerializer<T>
java.lang.Object
org.dominokit.jacksonapt.ser.map.key.KeySerializer<T>
- Direct Known Subclasses:
BooleanKeySerializer,DateKeySerializer,EnumKeySerializer,NumberKeySerializer,ObjectKeySerializer,ToStringKeySerializer,UUIDKeySerializer
public abstract class KeySerializer<T>
extends java.lang.Object
Base class for all the
Map key serializer. It handles null values and exceptions. The rest is delegated to implementations.- Version:
- $Id: $
- Author:
- Nicolas Morel
-
Constructor Summary
Constructors Constructor Description KeySerializer() -
Method Summary
Modifier and Type Method Description protected abstract java.lang.StringdoSerialize(T value, JsonSerializationContext ctx)Serializes a non-null object into aStringto use as map's key.booleanmustBeEscaped(JsonSerializationContext ctx)mustBeEscapedjava.lang.Stringserialize(T value, JsonSerializationContext ctx)Serializes an object into aStringto use as map's key.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
KeySerializer
public KeySerializer()
-
-
Method Details
-
mustBeEscaped
mustBeEscaped
- Parameters:
ctx- Context for the full serialization process- Returns:
- true if the serialized key must be escaped
-
serialize
public java.lang.String serialize(T value, JsonSerializationContext ctx) throws JsonSerializationExceptionSerializes an object into aStringto use as map's key.- Parameters:
value- Object to serializectx- Context for the full serialization process- Returns:
- the key
- Throws:
JsonSerializationException- if an error occurs during the serialization
-
doSerialize
Serializes a non-null object into aStringto use as map's key.- Parameters:
value- Object to serializectx- Context for the full serialization process- Returns:
- the key
-