# com.bea.ide.core
ICookieSupport Interface

public interface ICookieSupport

This interface is a general mechansim for storing information on an object that can be accessed using an associative lookup. This mechanism differs from properties in two ways: 1) The key is any object rather than a string. Therefore it is a slightly more general system. 2) There is no notification mechanism like property change listeners. Therefore, this mechanism is typically only useful for looking up private data or sharing data across components. The data stored will often belong, not to the object on which it is stored, but to a particular subsystem that uses the object and needs to store data about the object. This allows garbage collection to be more effective.

All Known Implementing Classes
  `DefaultDocument`, `JavaDocument`, `ControlDocument`, `ControlContainerDocument`, `DefaultSourceDocument`, `DefaultDocumentView`

All Known Subinterfaces
  `IDesignView`, `IDocument`, `IDocumentView`, `IProject`, `IRelatedDocument`, `ISourceDocument`, `ISourceView`, `IVersionedDocument`

## Method Summary

`public `Object`` | `addCookie`(`Object` key, `Object` cookie) Adds the cookie object to this object with the given key.
`public `Object`` | `getCookie`(`Object` key) Returns the cookie object for the corresponding key.
`public `Object`` | `removeCookie`(`Object` key) Removes an association between the specified key and its cookie.

## Method Detail

### addCookie(Object, Object) Method

    public Object addCookie(Object key,
                            Object cookie)

Adds the cookie object to this object with the given key. getCookie may be used to retrieve the cookie object by passing in the same key. Two keys that compare equal using Object.equals method will be considered the same key.

#### Parameters

key
  Key value to associate the cookie with.

cookie
  Object value to store and associate with the key.

#### Returns

If key previously had some cookie associated with it, that value is returned; otherwise `null` is returned. It is possible that the key was explicitly associated with the null object and this case cannot be distinguished from the case where the key had no previous association.

### getCookie(Object) Method

    public Object getCookie(Object key)

Returns the cookie object for the corresponding key. Associations are made using the addCookie method. Two keys that compare equal using Object.equals method will be considered the same key.

#### Parameters

key
  Key value to use for cookie lookup.

#### Returns

The cookie value associated with the key for this document; `null` if there is no association for the key. It is possible that the key was explicitly associated with the null object and this case cannot be distinguished from the case where the key has no association.

### removeCookie(Object) Method

    public Object removeCookie(Object key)

Removes an association between the specified key and its cookie. If the key had no association this method does nothing.

#### Returns

The cookie this key was previously associated with; `null` if there was no association. It is possible that the key was explicitly associated with the null object and this case cannot be distinguished from the case where the key had no previous association.