Documentation Archive Developer
Search
PATH Documentation > WebObjects

Table of Contents

NSDisposableRegistry


Inherits from:
Object
Implements:
NSDisposable
Serializable
Package:
com.webobjects.foundation


Class Description


An NSDisposableRegistry object is a registry of NSDisposable objects that should be disposed when the registry is disposed. You can add objects to a registry with addObject and addObjectsFromRegistry, remove objects with removeObject, and dispose of a registries objects with dispose.

There are two ways in which you might interact with a disposable registry: adding objects to another object's registry and creating a class whose instances manage their own disposable registries. As an example of the former, consider the EOController class (defined in the eoapplication package and used in Direct to Java Client applications). EOController has a disposable registry, which you can access with the EOController method disposableRegistry. In EOController's dispose method, it disposes its disposable registry, which in turn disposes all its objects. You can get a controller's registry and add objects to it; they will be disposed along with the EOController. The second way in which you might interact with a disposable registry, then, is to create a class similar to EOController that uses a disposable registry to group objects that should be disposed of along with instances of your class.




Constructors



NSDisposableRegistry

public NSDisposableRegistry()

Creates an empty disposable registry.




Instance Methods



addObject

public void addObject(NSDisposable anObject)

Adds anObject to the receiver so that anObject will be disposed when the receiver is disposed.

addObjectsFromRegistry

public void addObjectsFromRegistry(NSDisposableRegistry aDisposableRegistry)

Adds the objects in aDisposableRegistry to the receiver, so that aDisposableRegistry's objects will be disposed when the receiver is disposed.

dispose

public void dispose()

Conformance to NSDisposable. NSDisposableRegistry's implementation simply sends dispose to all its objects.

See Also: dispose ( NSDisposable)



removeObject

public void removeObject(NSDisposable anObject)

Removes anObject from the receiver.

toString

public String toString()

Returns a string representation of the receiver.

© 2001 Apple Computer, Inc. (Last Published April 17, 2001)


Table of Contents