com.webobjects.foundation
Interface NSDisposable
- All Known Implementing Classes:
- NSDisposableRegistry, NSUndoManager, EOObjectStore, EODatabase, EOModel, WODisplayGroup, EODisplayGroup, EOAssociation, EOWidgetAssociation.WidgetPlugin, EOTable, EOView, EOFormCell, EOControlActionAdapter, EOFrame, EODistributionContext, EOController, EODefaults, EOWindowObserver, EOControllerFactory
- public interface NSDisposable
The NSDisposable interface declares one method, dispose
, in
which an object prepares for destruction. In dispose
, an object
should clear all references that other objects have to it. For
example, if an NSDisposable object has assigned itself as
another object's delegate, the NSDisposable object should set
the other object's delegate to null
in dispose
,
thus clearing the other object's reference to the NSDisposable object.
By implementing NSDisposable, objects are given a chance
to remove references that other objects have to them. This
allows other objects to send dispose
messages to NSDisposable
objects when the NSDisposable objects are no longer needed. As
an example, Direct to Java Client disposes of controllers when
they are no longer needed, and subsequently, the NSDisposable
controllers are garbage collected.
Guidelines
You should implement NSDisposable if your object is a delegate for
another object. If you do implement NSDisposable, you should be sure
that your dispose
method will be invoked. If it won't be invoked
automatically, you can add yourself to an appropriate NSDisposableRegistry.
Known registries are provided by the com.webobjects.eoapplication
classes EOController and EOArchive.
- See Also:
dispose()
,
NSDisposableRegistry
Method Summary |
void |
dispose()
Invoked when the receiver should prepare itself for destruction. |
dispose
public void dispose()
- Invoked when the receiver should prepare itself for destruction.
Implementations of this method should break connections that
other objects have to the receiver, including unregistering for
notifications, resigning as other objects' delegates, release locks and system resources, close files, and any other
clean up operations.
Copyright © 2003 Apple Computer, Inc.