public abstract class AbstractCollectionHandler<C> extends Object implements CollectionHandler<C>
Constructor and Description |
---|
AbstractCollectionHandler() |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
clear(C target)
Calls the clear method on the target collection
|
protected abstract C |
create()
Creates a new instance of the collection class
|
protected C |
create(Class<?> elementClass) |
Class<?> |
determineGenericParameterFromType(ParameterizedType type) |
protected int |
getGenericParameterIndex() |
C |
getTargetCollection(BeanCollectionUsage collectionUsage,
Class<C> preferredCollectionClass,
Class<?> collectionElementClass,
C targetCollection,
CollectionFlusher collectionFlusher,
Boolean mustFlush)
Retrieves either the target collection or creates a new collection instance.
|
Class<C> |
getType()
The type of the collection class.
|
boolean |
isMatch(Class<?> clazz)
Check if the sourceClass contains the matching class somewhere in its
hierarchy
|
Object |
mapItem(BeanMapper beanMapper,
Class collectionElementClass,
Object source) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
copy, size
protected abstract void clear(C target)
target
- the collection to call clear() onprotected abstract C create()
public Object mapItem(BeanMapper beanMapper, Class collectionElementClass, Object source)
public C getTargetCollection(BeanCollectionUsage collectionUsage, Class<C> preferredCollectionClass, Class<?> collectionElementClass, C targetCollection, CollectionFlusher collectionFlusher, Boolean mustFlush)
CollectionHandler
getTargetCollection
in interface CollectionHandler<C>
collectionUsage
- the type of collection usage to applypreferredCollectionClass
- the class type of the target collectioncollectionElementClass
- the class type of an element within the target collectiontargetCollection
- the actual target collectioncollectionFlusher
- the flusher to call after clear has been called on a filled
collectionmustFlush
- whether flush must be called after clear on a collection has been
calledpublic Class<C> getType()
CollectionHandler
getType
in interface CollectionHandler<C>
public boolean isMatch(Class<?> clazz)
CollectionHandler
isMatch
in interface CollectionHandler<C>
clazz
- the class to check for the typepublic Class<?> determineGenericParameterFromType(ParameterizedType type)
determineGenericParameterFromType
in interface CollectionHandler<C>
protected int getGenericParameterIndex()
Copyright © 2015–2017 42 BV. All rights reserved.