WebObjects 5.2.3

com.webobjects.foundation
Interface NSDisposable

All Known Implementing Classes:
EOAssociation, EOControlActionAdapter, EOController, EOControllerFactory, EODatabase, EODefaults, EODisplayGroup, EODistributionContext, EOFormCell, EOFrame, EOModel, EOObjectStore, EOTable, EOView, EOWidgetAssociation.WidgetPlugin, EOWindowObserver, NSDisposableRegistry, NSUndoManager, WODisplayGroup

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.
 

Method Detail

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.


Last updated Thu Oct 21 15:04:16 PDT 2004.

Copyright © 2004 Apple Computer, Inc.