Class next.util.NextObject

CLASS DESCRIPTION

Extends:
java.lang.Object

Implements:
java/lang/Cloneable

next/util/KeyValueCoding

NextObject is the superclass of many of the classes in this package. From NextObject, other classes inherit a basic interface to the run-time system, and its instances enhance their ability to behave as objects.

Among other things, the NextObject class provides inheriting classes with a framework for creating, initializing, finalizing, copying, comparing, archiving and distributing objects, for performing methods selected at run-time. For example, to find out whether it implements a particular method, you'd send it a respondsToMethod message.

The NextObject class is mostly an abstract class; programs use instances of classes that inherit from NextObject, but rarely instances of NextObject itself.

The NextObject class defines a number of methods that subclasses are expected to override. Often, NextObject's default implementation simply returns the receiving object. Putting these "empty" methods in the NextObject class serves two purposes:


CONSTRUCTORS

NextObject

public NextObject()

Returns a newly-allocated and initialized object of the NextObject class.


METHODS

awakeAfterUsingCoder

public java.lang.Object awakeAfterUsingCoder(next.util.Coder aCoder)

Overridden by subclasses to return another object in its place after being decoded. Perhaps this object was just unarchived and an equivalent object already exists (such as a font or image). By returning a replacement object, redundant objects can be eliminated. If a replacement is returned, this method implementation is responsible for releasing the receiver. This method is invoked by Coder. NextObject's implementation simply returns the receiver.


clone

public java.lang.Object clone()

Returns a new instance that's a copy of the receiver. The copy returned is immutable if the consideration "immutable vs. mutable" applies to the receiving object; otherwise the exact nature of the copy is determined by the class.


equals

public boolean equals(java.lang.Object anObject)

Returns true if the receiver and anObject are equal, false otherwise. NextObject's implementation compares the id of anObject and the receiver to determine equality. Subclasses can override this method to redefine what it means for objects to be equal. For example, a container object might define two containers as equal if they contain the same contents. Note that equality as defined by this method is not necessarily reflexive. For example, A is equal to B, does not imply B is equal to A, especially if B is a subclass of A.


finalize

protected void finalize()

Releases any corresponding Objective-C object when the Java object is garbage collected.


hashCode

public int hashCode()

Returns an integer that can be used as a table address in a hash table structure. NextObject's implementation returns a value based on the object's id. If two objects are equal (as determined by the equal method), they must return the same hash value. This last point is particularly important if you define hash in a subclass and intend to put instances of that subclass into a collection.


loadLibrary

public static void loadLibrary(java.lang.String libraryName)

Loads a library and calls the library's initialization function. The name of the initialization function is constructed by appending "Initialize" to the name of the library and removing extensions like ".dll".

Note that libraries generated by bridget must be loaded using NextObject. loadLibrary rather than Runtime.loadLibrary, because the former performs initialization needed by bridget. NextObject.loadLibrary is idempotent--it will only load a requested library once so that it can, for example, be called from static initializers in many different classes.


nextRootPath

public final static java.lang.String nextRootPath()

Returns as a string the path to the $NEXT_ROOT directory--the directory in which WebObjects or OPENSTEP Enterprise was installed. This directory is usually something like "C:\Next".


performMethod

public next.util.NextObject performMethod(java.lang.String methodName)

Sends a methodName message to the receiver and returns the result of the message. If methodName is NULL, an exception is raised.

performMethod is equivalent to sending a methodName message directly to the receiver. However, performMethod allows you to send messages that aren't determined until run time.

methodName should identify a method that takes no arguments.


performMethodWithObject

public next.util.NextObject performMethodWithObject(java.lang.String methodName, java.lang.Object anObject)

Sends a methodName message to the receiver with anObject as the argument. If methodName is NULL, an exception is raised.

This method is the same as performMethod except that you can supply an argument for methodName. methodName should identify a method that takes a single argument of type java.lang.Object.


performMethodWithObjects

public next.util.NextObject performMethodWithObjects(java.lang.String methodName, java.lang.Object anObject, java.lang.Object anotherObject)

Sends the receiver an methodName message with anObject and anotherObject as arguments. If methodName is NULL, an exception is raised.

This method is the same as performMethod except that you can supply two arguments for methodName. methodName should identify a method that can take two arguments of type next.java.Object.


replacementObjectForArchiver

public next.util.Coding replacementObjectForArchiver(next.util.Coder aCoder)

Overridden by subclasses to substitute another object for itself during archiving. See the replacementObjectForArchiver: method description in the NSObject class specification (in the Foundation Framework Reference) for implementation information.


replacementObjectForPortCoder

public next.util.Coding replacementObjectForPortCoder(next.util.Coder aCoder)

Overridden by subclasses to substitute another object or a copy for itself during distribution encoding. See the replacementObjectForPortCoder: method description in the NSObject class specification (in the Foundation Framework Reference) for implementation information.


respondsToMethod

public boolean respondsToMethod(java.lang.String methodName)

Returns true if the receiver implements or inherits a method that can respond to methodName messages, false otherwise. The application is responsible for determining whether a false response should be considered an error.

Note that if the receiver is able to forward methodName messages to another object, it will be able to respond to the message, albeit indirectly, even though this method returns false.


takeValueForKey

public void takeValueForKey(java.lang.Object anObject, java.lang.String key)

Sets the value for the property identified by key to anObject. See the KeyValueCoding interface description for more information.


toString

public java.lang.String toString()

Returns a String object that describes the contents of the receiver. gdb's print-object command indirectly invokes this method to produce a textual description of an object.


valueForKey

public java.lang.Object valueForKey(java.lang.String key)

Returns the value for the property identified by key. See the KeyValueCoding interface description for more information.