WebObjects 5.2

com.webobjects.eocontrol
Class EOKeyGlobalID

java.lang.Object
  |
  +--com.webobjects.eocontrol.EOGlobalID
        |
        +--com.webobjects.eocontrol.EOKeyGlobalID
All Implemented Interfaces:
Cloneable, NSCoding, Serializable

public abstract class EOKeyGlobalID
extends EOGlobalID
implements NSCoding

EOKeyGlobalID is a concrete subclass of EOGlobalID whose instances, an entity and the primary key values for the object being identified, represent persistent IDs based on EOModel information. When creating an EOKeyGlobalID, the key values must be supplied following alphabetical order for their attribute names. EOKeyGlobalID defines the globalIDWithEntityName method for creating instances, but it's much more convenient to create instances from fetched rows using EOEntity's globalIDForRow method. (EOEntity and EOModel are defined in EOAccess.) Note that a constructor can't be used to create EOKeyGlobalIDs

See Also:
globalIDWithEntityName(String entityName, Object[] values), EOEntity.globalIDForRow(NSDictionary row), Serialized Form

Inner classes inherited from class com.webobjects.foundation.NSCoding
NSCoding.Support
 
Fields inherited from class com.webobjects.eocontrol.EOGlobalID
GlobalIDChangedNotification
 
Constructor Summary
protected EOKeyGlobalID(String entityName, int hashCode)
          Returns an EOKeyGlobalID object
 
Method Summary
 Class classForCoder()
          Allows the receiver to substitute a class other than its own (for example, a public superclass) for use during archiving (encoding) by an NSCoder.
static Object decodeObject(NSCoder coder)
          (Re)creates an object based on type information and data stored in coder.
 void encodeWithCoder(NSCoder coder)
          Archives the receiver's type information and data into coder.
 String entityName()
          Returns the name of the entity governing the object identified by the receiver.
static EOKeyGlobalID globalIDWithEntityName(String entityName, Object[] values)
          Returns an EOKeyGlobalID based on entityName and values.
 int hashCode()
          Returns an integer that can be used as a hash key in a hash table structure.
abstract  int keyCount()
          Returns the number of keys that form the (potentially composite) primary key of the receiver.
abstract  Object[] keyValues()
          Returns the keys that form the (potentially composite) primary key of the receiver.
 NSArray keyValuesArray()
          Returns the keys that form the (potentially composite) primary key of the receiver as an NSArray.
protected  Object readResolve()
           
 
Methods inherited from class com.webobjects.eocontrol.EOGlobalID
clone, equals, isTemporary
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EOKeyGlobalID

protected EOKeyGlobalID(String entityName,
                        int hashCode)
Returns an EOKeyGlobalID object
Parameters:
entityName - specifies name of entity
hashCode - specifies hashcode
Method Detail

classForCoder

public Class classForCoder()
Allows the receiver to substitute a class other than its own (for example, a public superclass) for use during archiving (encoding) by an NSCoder. Default is the value of the getClass method.
Specified by:
classForCoder in interface NSCoding
Returns:
the class to be used with an NSCoder
See Also:
encodeWithCoder(NSCoder coder), decodeObject(NSCoder coder), NSCoder, NSCoding

decodeObject

public static Object decodeObject(NSCoder coder)
(Re)creates an object based on type information and data stored in coder.
Parameters:
coder - stores object type information along with an object's data
Returns:
an Object (re)created from the data in coder
See Also:
encodeWithCoder(NSCoder coder), NSCoder, NSCoding

encodeWithCoder

public void encodeWithCoder(NSCoder coder)
Archives the receiver's type information and data into coder. The receiver can then be recreated using decodeObject. Custom type information can be used by overriding classForCoder.
Specified by:
encodeWithCoder in interface NSCoding
Parameters:
coder - stores object type information along with an object's data
See Also:
decodeObject(NSCoder coder), classForCoder(), NSCoder, NSCoding

entityName

public String entityName()
Returns the name of the entity governing the object identified by the receiver. This is used by EODatabaseContexts (EOAccess) to identify an EOEntity (EOAccess) in methods such as faultForGlobalID.
Returns:
a String representing the name of the entity governing the object identified by the receiver

globalIDWithEntityName

public static EOKeyGlobalID globalIDWithEntityName(String entityName,
                                                   Object[] values)
Returns an EOKeyGlobalID based on entityName and values. EOKeyGlobalIDs are more conveniently created using EOEntity's globalIDForRow method (EOAccess).
Parameters:
entityName - name of entity for which the new EOKeyGlobalID will be created
values - specifies primary key values for entityName
Returns:
returns an EOKeyGlobalID based on entityName and values
See Also:
EOEntity.globalIDForRow(NSDictionary row)

hashCode

public int hashCode()
Returns an integer that can be used as a hash key in a hash table structure. If two objects are equal (as determined by the equals method), they must have the same hash value.
Overrides:
hashCode in class EOGlobalID
Returns:
an int that can be used as a hash key in a hash table structure

keyCount

public abstract int keyCount()
Returns the number of keys that form the (potentially composite) primary key of the receiver.
Returns:
the int number of primary key values in the receiver

keyValues

public abstract Object[] keyValues()
Returns the keys that form the (potentially composite) primary key of the receiver.
Returns:
an array of the primary key value(s) of the receiver
See Also:
keyValuesArray()

keyValuesArray

public NSArray keyValuesArray()
Returns the keys that form the (potentially composite) primary key of the receiver as an NSArray.
Returns:
an NSArray of the primary key value(s) of the receiver
See Also:
keyValues()

readResolve

protected Object readResolve()
                      throws ObjectStreamException

Last updated Fri Feb 21 13:15:00 PST 2003.

Copyright © 2003 Apple Computer, Inc.