Oracle UIX API Reference
Release 2.1.22.0.0
B12196-01

oracle.cabo.share.util
Class BindableNamespaceMap

java.lang.Object
  |
  +--oracle.cabo.share.util.NamespaceMap
        |
        +--oracle.cabo.share.util.BindableNamespaceMap
All Implemented Interfaces:
java.lang.Cloneable

public class BindableNamespaceMap
extends NamespaceMap

BindableNamespaceMap extends NamespaceMap to support the Bindable interface. It adds one additional method, and changes the semantics of other functions.

Objects that implement the Bindable interface will automatically have their bindValue() and unbindValue() methods called as they are added and removed from the map. In addition, all methods that return stored values - including Enumerations - will automatically unwrap Bindable objects by calling through its getValue() method.

The new function is unbindAll(). It removes all Bindable objects - and, in doing so, triggers all of their unbindValue() methods. This method makes it much simpler to add automatic cleanup of namespaced properties stored in a context.

See Also:
Bindable

Constructor Summary
BindableNamespaceMap()
          Creates a BindableNamespaceMap, using a default size for the number of values per namespace.
BindableNamespaceMap(int defaultSize)
          Creates a BindableNamespaceMap.
 
Method Summary
 void clear()
          Clears all values in all namespaces.
 void clear(java.lang.String namespace)
          clears all keys from a namespace.
 java.lang.Object clone()
          Returns a clone of the NamespaceMap.
 java.lang.Object get(java.lang.String namespace, java.lang.Object key)
          Returns the stored object.
 java.lang.Object getRawValue(java.lang.String namespace, java.lang.Object key)
          Returns the stored object, without unwrapping Bindable objects.
 java.util.Enumeration getValueEnumeration()
          Returns an Enumeration over all the values added to the map.
 java.util.Enumeration getValueEnumeration(java.lang.String namespace)
          Returns an Enumeration over all of the values for a particular namespace.
 void put(java.lang.String namespace, java.lang.Object key, java.lang.Object value)
          Associates a value with a namespace and a key.
 java.lang.Object remove(java.lang.String namespace, java.lang.Object key)
          Removes a key from a namespace.
 void unbindAll()
          Unbinds all "bindable" objects.
 
Methods inherited from class oracle.cabo.share.util.NamespaceMap
getKeysEnumeration, getNamespaceEnumeration
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BindableNamespaceMap

public BindableNamespaceMap()
Creates a BindableNamespaceMap, using a default size for the number of values per namespace.

BindableNamespaceMap

public BindableNamespaceMap(int defaultSize)
Creates a BindableNamespaceMap.
Parameters:
defaultSize - the default size of each per-namespace storage.
Method Detail

unbindAll

public void unbindAll()
Unbinds all "bindable" objects. Any contained value that implements Bindable will have unbindValue called, and then will be removed from the map.
See Also:
Bindable.unbindValue()

get

public java.lang.Object get(java.lang.String namespace,
                            java.lang.Object key)
Returns the stored object. If the object implements Bindable, it is automatically unwrapped via getValue().
Overrides:
get in class NamespaceMap
Parameters:
namespace - the namespace to search.
key - the key to search the namespace for.
Returns:
null if such a namespace/key does not exist. else returns the associated value.
See Also:
Bindable.getValue()

put

public void put(java.lang.String namespace,
                java.lang.Object key,
                java.lang.Object value)
Associates a value with a namespace and a key. If the new value implements Bindable, its bindValue() method is called. If the old value implements Bindable, its unbindValue() method is called.
Overrides:
put in class NamespaceMap
Parameters:
namespace - namespace of the value
key - the key to associate the value with
value - the value to associate with the key.
See Also:
Bindable.getValue(), Bindable.bindValue(), Bindable.unbindValue()

remove

public java.lang.Object remove(java.lang.String namespace,
                               java.lang.Object key)
Removes a key from a namespace. If the value implements Bindable, unbindValue() is called after it is removed.
Overrides:
remove in class NamespaceMap
Parameters:
namespace - the namespace to search.
key - the key to search the namespace for.
Returns:
the associated value, or null if the namespace/key does not exist.
See Also:
Bindable.unbindValue()

getValueEnumeration

public java.util.Enumeration getValueEnumeration()
Returns an Enumeration over all the values added to the map.
Overrides:
getValueEnumeration in class NamespaceMap
See Also:
Bindable.getValue()

getValueEnumeration

public java.util.Enumeration getValueEnumeration(java.lang.String namespace)
Returns an Enumeration over all of the values for a particular namespace.
Overrides:
getValueEnumeration in class NamespaceMap
See Also:
Bindable.getValue()

clear

public void clear()
Clears all values in all namespaces. unbindValue() will be called on all Bindable objects.
Overrides:
clear in class NamespaceMap

clear

public void clear(java.lang.String namespace)
clears all keys from a namespace.
Overrides:
clear in class NamespaceMap
Parameters:
namespace - the namespace to clear.

clone

public java.lang.Object clone()
Returns a clone of the NamespaceMap.
Overrides:
clone in class NamespaceMap

getRawValue

public java.lang.Object getRawValue(java.lang.String namespace,
                                    java.lang.Object key)
Returns the stored object, without unwrapping Bindable objects.
Parameters:
namespace - the namespace to search.
key - the key to search the namespace for.
Returns:
null if such a namespace/key does not exist. else returns the associated value.
See Also:
Bindable.getValue()

Oracle UIX API Reference
Release 2.1.22.0.0
B12196-01

Copyright © 2002,2003, Oracle. All Rights Reserved.