Class TopiaEntityMap<K extends TopiaEntityEnum,​V extends TopiaEntity>

java.lang.Object
java.util.AbstractMap<K,​V>
java.util.HashMap<K,​java.util.List<? extends V>>
org.nuiton.topia.persistence.util.TopiaEntityMap<K,​V>
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map<K,​java.util.List<? extends V>>

public abstract class TopiaEntityMap<K extends TopiaEntityEnum,​V extends TopiaEntity>
extends java.util.HashMap<K,​java.util.List<? extends V>>
A dictionnary of TopiaEntity associated to a TopiaEntityEnum.
Since:
2.5.3
Author:
tchemit <chemit@codelutin.com>
See Also:
Serialized Form
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.util.AbstractMap

    java.util.AbstractMap.SimpleEntry<K extends java.lang.Object,​V extends java.lang.Object>, java.util.AbstractMap.SimpleImmutableEntry<K extends java.lang.Object,​V extends java.lang.Object>

    Nested classes/interfaces inherited from interface java.util.Map

    java.util.Map.Entry<K extends java.lang.Object,​V extends java.lang.Object>
  • Constructor Summary

    Constructors 
    Constructor Description
    TopiaEntityMap()  
    TopiaEntityMap​(int initialCapacity)  
    TopiaEntityMap​(int initialCapacity, float loadFactor)  
    TopiaEntityMap​(java.util.Map<? extends K,​? extends java.util.List<? extends V>> m)  
  • Method Summary

    Modifier and Type Method Description
    <T extends V>
    void
    addEntity​(T entity)
    Adds the given entity to the dictonary (even if it does already exists).
    <T extends V>
    boolean
    addUniqueEntity​(T entity)
    Adds the given entity to the dictonary only if it does not exists.
    <T extends V>
    java.util.List<T>
    get​(java.lang.Class<T> type)  
    protected <T extends V>
    java.util.List<T>
    getList​(T entity)  
    protected abstract K getType​(java.lang.Class<?> e)
    Obtains 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, values

    Methods inherited from class java.util.AbstractMap

    equals, hashCode, toString

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface java.util.Map

    equals, hashCode
  • Constructor Details

    • TopiaEntityMap

      public TopiaEntityMap​(int initialCapacity, float loadFactor)
    • TopiaEntityMap

      public TopiaEntityMap​(int initialCapacity)
    • TopiaEntityMap

      public TopiaEntityMap()
    • TopiaEntityMap

      public TopiaEntityMap​(java.util.Map<? extends K,​? extends java.util.List<? extends V>> m)
  • Method Details

    • getType

      protected abstract K getType​(java.lang.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> java.util.List<T> get​(java.lang.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> java.util.List<T> getList​(T entity)