public class MapRepresentationHandler extends java.lang.Object implements RepresentationHandler
Map instances.| Modifier and Type | Field and Description |
|---|---|
protected RepresentationHandler |
keyHandler
Handler for the map's keys.
|
protected java.lang.reflect.Type |
keyType
Type of the map's keys.
|
protected java.lang.Class<?> |
mapType
Class of the map.
|
protected RepresentationHandler |
valueHandler
Handler for the map's values.
|
protected java.lang.reflect.Type |
valueType
Type of the map#s values.
|
| Constructor and Description |
|---|
MapRepresentationHandler(RepresentationHandler keyHandler,
RepresentationHandler valueHandler,
java.lang.reflect.Type mapType) |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
canHandle(java.lang.reflect.Type mapType)
Checks whether this handler can handle maps of the given type.
|
java.lang.Object |
deserializeFromRepresentation(Representation repr,
java.util.function.Function<java.lang.String,RepresentationRestorer> getRegisteredRestorer)
Deserializes the given representation using the given representation restorers.
|
static java.lang.reflect.Type |
getKeyType(java.lang.reflect.Type mapType)
Retrieves the key type of the given map type.
|
static java.lang.reflect.Type |
getValueType(java.lang.reflect.Type mapType)
Retrieves the value type of the given map type.
|
Representation |
serializeToRepresentation(java.lang.Object obj)
Serializes (creates a representation of) the given object.
|
protected RepresentationHandler keyHandler
protected RepresentationHandler valueHandler
protected java.lang.Class<?> mapType
protected java.lang.reflect.Type keyType
protected java.lang.reflect.Type valueType
public MapRepresentationHandler(RepresentationHandler keyHandler, RepresentationHandler valueHandler, java.lang.reflect.Type mapType)
public static java.lang.reflect.Type getKeyType(java.lang.reflect.Type mapType)
mapType - the map typepublic static java.lang.reflect.Type getValueType(java.lang.reflect.Type mapType)
mapType - the map typepublic static boolean canHandle(java.lang.reflect.Type mapType)
mapType - the type to checkpublic java.lang.Object deserializeFromRepresentation(Representation repr, java.util.function.Function<java.lang.String,RepresentationRestorer> getRegisteredRestorer)
RepresentationHandlerdeserializeFromRepresentation in interface RepresentationHandlerrepr - the representation to deserializegetRegisteredRestorer - maps representation restorer names to the restorerspublic Representation serializeToRepresentation(java.lang.Object obj)
RepresentationHandlerserializeToRepresentation in interface RepresentationHandlerobj - the object to serialize