Class ConcurrentGroupMap<K,V>

java.lang.Object
java.util.AbstractMap<K,V>
java.util.concurrent.ConcurrentHashMap<K,V>
org.jivesoftware.openfire.group.ConcurrentGroupMap<K,V>
All Implemented Interfaces:
Serializable, ConcurrentMap<K,V>, Map<K,V>, GroupAwareMap<K,V>

public class ConcurrentGroupMap<K,V> extends ConcurrentHashMap<K,V> implements GroupAwareMap<K,V>
This extension class provides additional methods that understand groups among the entries in the map.
Author:
Tom Evans
See Also:
  • Constructor Details

    • ConcurrentGroupMap

      public ConcurrentGroupMap()
  • Method Details

    • includesKey

      public boolean includesKey(Object key)
      Returns true if the key list contains the given JID. If the JID is not found in the key list (exact match), search the key list for groups and look for the JID in each of the corresponding groups (implied match).
      Specified by:
      includesKey in interface GroupAwareMap<K,V>
      Parameters:
      key - The target, presumably a JID
      Returns:
      True if the target is in the key list, or in any groups in the key list
    • includesValue

      public boolean includesValue(Object value)
      Returns true if the map has an entry value matching the given JID. If the JID is not found in the value set (exact match), search the value set for groups and look for the JID in each of the corresponding groups (implied match).
      Specified by:
      includesValue in interface GroupAwareMap<K,V>
      Parameters:
      value - The target, presumably a JID
      Returns:
      True if the target is in the value set, or in any groups in the value set
    • getGroupsFromKeys

      public Set<Group> getGroupsFromKeys()
      Returns the groups that are implied (resolvable) from the keys in the map.
      Specified by:
      getGroupsFromKeys in interface GroupAwareMap<K,V>
      Returns:
      A Set containing the groups among the keys
    • getGroupsFromValues

      public Set<Group> getGroupsFromValues()
      Returns the groups that are implied (resolvable) from the values in the map.
      Specified by:
      getGroupsFromValues in interface GroupAwareMap<K,V>
      Returns:
      A Set containing the groups among the values
    • put

      public V put(K key, V value)
      Specified by:
      put in interface Map<K,V>
      Overrides:
      put in class ConcurrentHashMap<K,V>
    • putIfAbsent

      public V putIfAbsent(K key, V value)
      Specified by:
      putIfAbsent in interface ConcurrentMap<K,V>
      Specified by:
      putIfAbsent in interface Map<K,V>
      Overrides:
      putIfAbsent in class ConcurrentHashMap<K,V>
    • putAll

      public void putAll(Map<? extends K,? extends V> m)
      Specified by:
      putAll in interface Map<K,V>
      Overrides:
      putAll in class ConcurrentHashMap<K,V>
    • remove

      public V remove(Object key)
      Specified by:
      remove in interface Map<K,V>
      Overrides:
      remove in class ConcurrentHashMap<K,V>
    • remove

      public boolean remove(Object key, Object value)
      Specified by:
      remove in interface ConcurrentMap<K,V>
      Specified by:
      remove in interface Map<K,V>
      Overrides:
      remove in class ConcurrentHashMap<K,V>
    • replace

      public boolean replace(K key, V oldValue, V newValue)
      Specified by:
      replace in interface ConcurrentMap<K,V>
      Specified by:
      replace in interface Map<K,V>
      Overrides:
      replace in class ConcurrentHashMap<K,V>
    • replace

      public V replace(K key, V value)
      Specified by:
      replace in interface ConcurrentMap<K,V>
      Specified by:
      replace in interface Map<K,V>
      Overrides:
      replace in class ConcurrentHashMap<K,V>
    • clear

      public void clear()
      Specified by:
      clear in interface Map<K,V>
      Overrides:
      clear in class ConcurrentHashMap<K,V>