GroupAwareMap.java 1.41 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
package org.jivesoftware.openfire.group;

import java.util.Map;
import java.util.Set;

/**
 * This map specifies additional methods that understand groups among 
 * the entries in the map.
 * 
 * @author Tom Evans
 */

public interface GroupAwareMap<K, V> extends Map<K, V> {

	/**
	 * Returns true if the map's keySet contains the given JID. If the JID
	 * is not found explicitly, search the keySet for groups and look 
	 * for the JID in each of the corresponding groups.
	 * 
	 * @param key The target, presumably a JID
	 * @return True if the target is in the key list, or in any groups in the key list
	 */
	public boolean includesKey(Object key);

	/**
26
	 * Returns true if the map contains a value referencing the given JID. If the JID
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
	 * is not found explicitly, search the values for groups and look 
	 * for the JID in each of the corresponding groups.
	 * 
	 * @param value The target, presumably a JID
	 * @return True if the target is in the key list, or in any groups in the key list
	 */
	public boolean includesValue(Object value);
	
	/**
	 * Returns the groups that are implied (resolvable) from the keys in the map.
	 * 
	 * @return A new Set containing the groups in the keySet
	 */
	Set<Group> getGroupsFromKeys();
	
	/**
	 * Returns the groups that are implied (resolvable) from the values in the map.
	 * 
	 * @return A new Set containing the groups among the mapped values
	 */
	Set<Group> getGroupsFromValues();
	
}