org.nuiton.topia.persistence.util
Class TopiaEntityMap<K extends TopiaEntityEnum,V extends TopiaEntity>
java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<K,List<? extends V>>
org.nuiton.topia.persistence.util.TopiaEntityMap<K,V>
- All Implemented Interfaces:
- Serializable, Cloneable, Map<K,List<? extends V>>
public abstract class TopiaEntityMap<K extends TopiaEntityEnum,V extends TopiaEntity>
- extends HashMap<K,List<? extends V>>
A dictionnary of TopiaEntity associated to a TopiaEntityEnum.
- Since:
- 2.5.3
- Author:
- tchemit
- See Also:
- Serialized Form
|
Method Summary |
|
addEntity(T entity)
Adds the given entity to the dictonary (even if it does already exists). |
|
addUniqueEntity(T entity)
Adds the given entity to the dictonary only if it does not exists. |
|
get(Class<T> type)
|
protected
|
getList(T entity)
|
protected abstract K |
getType(Class<?> e)
Obtains from a entity his key. |
| Methods inherited from class java.util.HashMap |
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values |
TopiaEntityMap
public TopiaEntityMap(int initialCapacity,
float loadFactor)
TopiaEntityMap
public TopiaEntityMap(int initialCapacity)
TopiaEntityMap
public TopiaEntityMap()
TopiaEntityMap
public TopiaEntityMap(Map<? extends K,? extends List<? extends V>> m)
getType
protected abstract K getType(Class<?> e)
- Obtains from a entity his key.
- Parameters:
e - the entity on which to find the key.
- Returns:
- the key of the given entity.
get
public <T extends V> List<T> get(Class<T> type)
addUniqueEntity
public <T extends V> boolean addUniqueEntity(T entity)
- Adds the given entity to the dictonary only if it does not exists.
Will return
true if entity was added, false otherwise.
- Type Parameters:
T - the type of entity to add- Parameters:
entity - the entity to add
- Returns:
true if entity was added, false otherwise.
addEntity
public <T extends V> void addEntity(T entity)
- Adds the given entity to the dictonary (even if it does already exists).
- Type Parameters:
T - the type of entity to add- Parameters:
entity - the entity to add
getList
protected <T extends V> List<T> getList(T entity)
Copyright © 2004-2011 CodeLutin. All Rights Reserved.