Overview | Package | Class | Tree | Deprecated | Index | Help
| Oracle TopLink API Reference 10g Release 3 (10.1.3) B13698-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## oracle.toplink.indirection
Class IndirectMap

`java.lang.Object
java.util.Dictionary
java.util.Hashtable
oracle.toplink.indirection.IndirectMap`

All Implemented Interfaces:
  ChangeTracker, java.lang.Cloneable, CollectionChangeTracker, IndirectContainer, java.util.Map, java.io.Serializable

public class IndirectMap
extends java.util.Hashtable
implements CollectionChangeTracker, IndirectContainer

IndirectMap allows a domain class to take advantage of TopLink indirection without having to declare its instance variable as a ValueHolderInterface.

To use an IndirectMap:

- Declare the appropriate instance variable with type Hashtable (jdk1.1) or Map (jdk1.2).
- Send the message #useTransparentMap(String) to the appropriate CollectionMapping.

TopLink will place an IndirectMap in the instance variable when the containing domain object is read from the datatabase. With the first message sent to the IndirectMap, the contents are fetched from the database and normal Hashtable/Map behavior is resumed.

Since:
  TOPLink/Java 2.5
See Also:
  `CollectionMapping`, `IndirectList`, Serialized Form

Constructor Summary
`IndirectMap()` PUBLIC: Construct a new, empty IndirectMap with a default capacity and load factor.
`IndirectMap(int initialCapacity)` PUBLIC: Construct a new, empty IndirectMap with the specified initial capacity and default load factor.
`IndirectMap(int initialCapacity, float loadFactor)` PUBLIC: Construct a new, empty IndirectMap with the specified initial capacity and load factor.
`IndirectMap(java.util.Map m)` PUBLIC: Construct a new IndirectMap with the same mappings as the given Map.

Method Summary
`void` | `clear()`
`java.lang.Object` | `clone()`
`boolean` | `contains(java.lang.Object value)`
`boolean` | `containsKey(java.lang.Object key)`
`boolean` | `containsValue(java.lang.Object value)`
`java.util.Enumeration` | `elements()`
`java.util.Set` | `entrySet()`
`boolean` | `equals(java.lang.Object o)`
`java.lang.Object` | `get(java.lang.Object key)`
`java.lang.String` | `getTopLinkAttributeName()` Return the mapping attribute name, used to raise change events.
`java.beans.PropertyChangeListener` | `getTopLinkPropertyChangeListener()` Return the property change listener for change tracking.
`ValueHolderInterface` | `getValueHolder()` PUBLIC: Return the valueHolder.
`int` | `hashCode()`
`boolean` | `hasTopLinkPropertyChangeListener()` Return if the collection has a property change listener for change tracking.
`boolean` | `isEmpty()`
`boolean` | `isInstantiated()` PUBLIC: Return whether the contents have been read from the database.
`java.util.Enumeration` | `keys()`
`java.util.Set` | `keySet()`
`java.lang.Object` | `put(java.lang.Object key, java.lang.Object value)`
`void` | `putAll(java.util.Map t)`
`java.lang.Object` | `remove(java.lang.Object key)`
`void` | `setTopLinkAttributeName(java.lang.String attributeName)` Set the mapping attribute name, used to raise change events.
`void` | `setTopLinkPropertyChangeListener(java.beans.PropertyChangeListener changeListener)` Set the property change listener for change tracking.
`void` | `setValueHolder(ValueHolderInterface valueHolder)` PUBLIC: Set the value holder.
`int` | `size()`
`java.lang.String` | `toString()` PUBLIC: Use the Hashtable.toString(); but wrap it with braces to indicate there is a bit of indirection.
`java.util.Collection` | `values()`

Methods inherited from class java.lang.Object
`getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### IndirectMap

    public IndirectMap()

  PUBLIC: Construct a new, empty IndirectMap with a default capacity and load factor.

### IndirectMap

    public IndirectMap(int initialCapacity)

  PUBLIC: Construct a new, empty IndirectMap with the specified initial capacity and default load factor.
Parameters:
  `initialCapacity` - the initial capacity of the hashtable

### IndirectMap

    public IndirectMap(int initialCapacity,
                       float loadFactor)

  PUBLIC: Construct a new, empty IndirectMap with the specified initial capacity and load factor.
Parameters:
  `initialCapacity` - the initial capacity of the hashtable
  `loadFactor` - a number between 0.0 and 1.0
Throws:
  `java.lang.IllegalArgumentException` - if the initial capacity is less than or equal to zero, or if the load factor is less than or equal to zero

### IndirectMap

    public IndirectMap(java.util.Map m)

  PUBLIC: Construct a new IndirectMap with the same mappings as the given Map. The IndirectMap is created with a capacity of twice the number of entries in the given Map or 11 (whichever is greater), and a default load factor, which is 0.75.
Parameters:
  `m` - a map containing the mappings to use

Method Detail

### clear

    public void clear()

  Specified by:
    `clear` in interface `java.util.Map`
  See Also:
    `Hashtable.clear()`

### clone

    public java.lang.Object clone()

  See Also:
    `This will result in a database query if necessary.`

### contains

    public boolean contains(java.lang.Object value)

  See Also:
    `Hashtable.contains(java.lang.Object)`

### containsKey

    public boolean containsKey(java.lang.Object key)

  Specified by:
    `containsKey` in interface `java.util.Map`
  See Also:
    `Hashtable.containsKey(java.lang.Object)`

### containsValue

    public boolean containsValue(java.lang.Object value)

  Specified by:
    `containsValue` in interface `java.util.Map`
  See Also:
    `Hashtable.containsValue(java.lang.Object)`

### elements

    public java.util.Enumeration elements()

  See Also:
    `Hashtable.elements()`

### entrySet

    public java.util.Set entrySet()

  Specified by:
    `entrySet` in interface `java.util.Map`
  See Also:
    `Hashtable.entrySet()`

### equals

    public boolean equals(java.lang.Object o)

  Specified by:
    `equals` in interface `java.util.Map`
  See Also:
    `Hashtable.equals(java.lang.Object)`

### get

    public java.lang.Object get(java.lang.Object key)

  Specified by:
    `get` in interface `java.util.Map`
  See Also:
    `Hashtable.get(java.lang.Object)`

### getTopLinkAttributeName

    public java.lang.String getTopLinkAttributeName()

  Return the mapping attribute name, used to raise change events.
  Specified by:
    `getTopLinkAttributeName` in interface `CollectionChangeTracker`

### getTopLinkPropertyChangeListener

    public java.beans.PropertyChangeListener getTopLinkPropertyChangeListener()

  Return the property change listener for change tracking.
  Specified by:
    `getTopLinkPropertyChangeListener` in interface `ChangeTracker`

### getValueHolder

    public ValueHolderInterface getValueHolder()

  PUBLIC: Return the valueHolder.
  Specified by:
    `getValueHolder` in interface `IndirectContainer`
  Returns:
    oracle.toplink.indirection.ValueHolderInterface A representation of the valueholder * which this container uses

### hashCode

    public int hashCode()

  Specified by:
    `hashCode` in interface `java.util.Map`
  See Also:
    `Hashtable.hashCode()`

### hasTopLinkPropertyChangeListener

    public boolean hasTopLinkPropertyChangeListener()

  Return if the collection has a property change listener for change tracking.

### isEmpty

    public boolean isEmpty()

  Specified by:
    `isEmpty` in interface `java.util.Map`
  See Also:
    `Hashtable.isEmpty()`

### isInstantiated

    public boolean isInstantiated()

  PUBLIC: Return whether the contents have been read from the database.
  Specified by:
    `isInstantiated` in interface `IndirectContainer`

### keys

    public java.util.Enumeration keys()

  See Also:
    `Hashtable.keys()`

### keySet

    public java.util.Set keySet()

  Specified by:
    `keySet` in interface `java.util.Map`
  See Also:
    `Hashtable.keySet()`

### put

    public java.lang.Object put(java.lang.Object key,
                                java.lang.Object value)

  Specified by:
    `put` in interface `java.util.Map`
  See Also:
    `Hashtable.put(java.lang.Object, java.lang.Object)`

### putAll

    public void putAll(java.util.Map t)

  Specified by:
    `putAll` in interface `java.util.Map`
  See Also:
    `Hashtable.putAll(java.util.Map)`

### remove

    public java.lang.Object remove(java.lang.Object key)

  Specified by:
    `remove` in interface `java.util.Map`
  See Also:
    `Hashtable.remove(java.lang.Object)`

### setTopLinkAttributeName

    public void setTopLinkAttributeName(java.lang.String attributeName)

  Set the mapping attribute name, used to raise change events. This is required if the change listener is set.
  Specified by:
    `setTopLinkAttributeName` in interface `CollectionChangeTracker`

### setTopLinkPropertyChangeListener

    public void setTopLinkPropertyChangeListener(java.beans.PropertyChangeListener changeListener)

  Set the property change listener for change tracking.
  Specified by:
    `setTopLinkPropertyChangeListener` in interface `ChangeTracker`

### setValueHolder

    public void setValueHolder(ValueHolderInterface valueHolder)

  PUBLIC: Set the value holder.
  Specified by:
    `setValueHolder` in interface `IndirectContainer`

### size

    public int size()

  Specified by:
    `size` in interface `java.util.Map`
  See Also:
    `Hashtable.size()`

### toString

    public java.lang.String toString()

  PUBLIC: Use the Hashtable.toString(); but wrap it with braces to indicate there is a bit of indirection. Don't allow this method to trigger a database read.
  See Also:
    `Hashtable.toString()`

### values

    public java.util.Collection values()

  Specified by:
    `values` in interface `java.util.Map`
  See Also:
    `Hashtable.values()`

Overview | Package | Class | Tree | Deprecated | Index | Help
| Copyright © 1998, 2006, Oracle. All Rights Reserved.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD