WebObjects 5.4.2

com.webobjects.eocontrol
Class EOKeyGlobalID

java.lang.Object
  extended by com.webobjects.eocontrol.EOGlobalID
      extended by com.webobjects.eocontrol.EOKeyGlobalID
All Implemented Interfaces:
NSCoding, Serializable, Cloneable

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:
EOKeyGlobalID.globalIDWithEntityName(String entityName, Object[] values), EOEntity.globalIDForRow(NSDictionary row), Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.webobjects.foundation.NSCoding
NSCoding.Support
 
Field Summary
 
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

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)

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

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.

Specified by:
hashCode in class EOGlobalID
Returns:
an int that can be used as a hash key in a hash table structure

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:
EOKeyGlobalID.keyValuesArray()

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

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:
EOKeyGlobalID.keyValues()

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:
EOKeyGlobalID.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:
EOKeyGlobalID.decodeObject(NSCoder coder), EOKeyGlobalID.classForCoder(), NSCoder, NSCoding

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:
EOKeyGlobalID.encodeWithCoder(NSCoder coder), EOKeyGlobalID.decodeObject(NSCoder coder), NSCoder, NSCoding

readResolve

protected Object readResolve()
                      throws ObjectStreamException
Throws:
ObjectStreamException

Last updated June 2008

Copyright © 2000-2008 Apple Inc.