Oracle Entitlements Server for Java API Reference

com.bea.security
Class HashMapContext

java.lang.Object
  |
  +--java.util.AbstractMap
        |
        +--java.util.HashMap
              |
              +--com.bea.security.HashMapContext

public class HashMapContext
extends java.util.HashMap
implements AppContext

The HashMapContext class is a simple implementation of an application context based on a java hashmap. Applications may choose to use this class as a basis for their application context, or implement their own.

Author:
Copyright © 2004-2008, Oracle and/or its affiliates. All rights reserved.
See Also:
Serialized Form

Constructor Summary
HashMapContext()
           
 
Method Summary
 void addElement(AppContextElement elem)
          Adds an AppContextElement into this context.
 void bulkAdd(AppContext ctx)
          Does a bulk add of elements from another context into this context.
 AppContextElement getElement(java.lang.String name)
          Gets an AppContextElement from this context by name.
 AppContextElement[] getElements(java.lang.String[] names)
          Gets an array of AppContextElements from this context given an array of names.
 java.lang.String[] getNames()
          Gets the names of the elements available in this context.
 void removeElement(java.lang.String name)
          Removes an AppContextElement from this context by name.
 int size()
          Gets the number of AppContextElements in this context.
 
Methods inherited from class java.util.HashMap
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, 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
 

Constructor Detail

HashMapContext

public HashMapContext()
Method Detail

getNames

public java.lang.String[] getNames()
Gets the names of the elements available in this context.
Specified by:
getNames in interface AppContext

Returns:
an array of Strings that are the names of the elements in this context.

getElement

public AppContextElement getElement(java.lang.String name)
Gets an AppContextElement from this context by name.
Specified by:
getElement in interface AppContext

Parameters:
name - a String that is the name of the element to retrieve from this context.
Returns:
a AppContextElement with the name requested. If the name requested is not in the context, a null is returned.

getElements

public AppContextElement[] getElements(java.lang.String[] names)
Gets an array of AppContextElements from this context given an array of names.
Specified by:
getElements in interface AppContext

Parameters:
names - an array of Strings that are the names of the elements being requested.
Returns:
an array of AppContextElements that were requested by name and available in the context. If no requested elements are available, then an empty array is returned.

size

public int size()
Gets the number of AppContextElements in this context.
Specified by:
size in interface AppContext

Returns:
an int of the number of elements in this context.
Overrides:
size in class java.util.HashMap

addElement

public void addElement(AppContextElement elem)
Adds an AppContextElement into this context.

Parameters:
elem - an AppContextElement to add to this context. If an element of this name already exists, then this new element will replace it.

removeElement

public void removeElement(java.lang.String name)
Removes an AppContextElement from this context by name.

Parameters:
name - a String that is the name of the element to be removed.

bulkAdd

public void bulkAdd(AppContext ctx)
Does a bulk add of elements from another context into this context.

Parameters:
ctx - an AppContext object whose values need to be cloned and added.