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:
- Tony Chemit - chemit@codelutin.com
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> -
Constructor Summary
ConstructorsConstructorDescriptionTopiaEntityMap(int initialCapacity) TopiaEntityMap(int initialCapacity, float loadFactor) TopiaEntityMap(Map<? extends K, ? extends List<? extends V>> m) -
Method Summary
Modifier and TypeMethodDescription<T extends V>
voidaddEntity(T entity) Adds the given entity to the dictonary (even if it does already exists).<T extends V>
booleanaddUniqueEntity(T entity) Adds the given entity to the dictonary only if it does not exists.getList(T entity) protected abstract KObtains from a entity his key.Methods inherited from class java.util.HashMap
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, valuesMethods inherited from class java.util.AbstractMap
equals, hashCode, toString
-
Constructor Details
-
TopiaEntityMap
public TopiaEntityMap(int initialCapacity, float loadFactor) -
TopiaEntityMap
public TopiaEntityMap(int initialCapacity) -
TopiaEntityMap
public TopiaEntityMap() -
TopiaEntityMap
-
-
Method Details
-
getType
Obtains from a entity his key.- Parameters:
e- the entity on which to find the key.- Returns:
- the key of the given entity.
-
get
-
addUniqueEntity
Adds the given entity to the dictonary only if it does not exists. Will returntrueif entity was added,falseotherwise.- Type Parameters:
T- the type of entity to add- Parameters:
entity- the entity to add- Returns:
trueif entity was added,falseotherwise.
-
addEntity
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
-