public class ListAndSetRepresentationHandler extends java.lang.Object implements RepresentationHandler
List and Set instances.| Modifier and Type | Field and Description |
|---|---|
protected java.lang.Class<?> |
collectionType
Class of the list/set object.
|
protected RepresentationHandler |
elementHandler
Handler for the list/set elements.
|
protected java.lang.reflect.Type |
elementType
Type of the list/set elements.
|
| Constructor and Description |
|---|
ListAndSetRepresentationHandler(RepresentationHandler elementHandler,
java.lang.reflect.Type collectionType) |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
canHandle(java.lang.reflect.Type collectionType)
Checks whether this handler can handle lists/sets 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 |
getElementType(java.lang.reflect.Type collectionType)
Retrieves the type of the elements of the given collection type.
|
Representation |
serializeToRepresentation(java.lang.Object obj)
Serializes (creates a representation of) the given object.
|
protected RepresentationHandler elementHandler
protected java.lang.Class<?> collectionType
protected java.lang.reflect.Type elementType
public ListAndSetRepresentationHandler(RepresentationHandler elementHandler, java.lang.reflect.Type collectionType)
public static java.lang.reflect.Type getElementType(java.lang.reflect.Type collectionType)
collectionType - the type of the collectionpublic static boolean canHandle(java.lang.reflect.Type collectionType)
collectionType - 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