EOClassDescription
- Inherits from:
- (com.apple.client.eocontrol) Object
(com.apple.yellow.eocontrol) NSObject
- Package:
- com.apple.client.eocontrol
- com.apple.yellow.eocontrol
Class Description
The EOClassDescription class provides a mechanism for extending classes by giving them access to metadata not available in the run-time system. This is achieved as follows:
- EOClassDescription provides a bridge between enterprise objects and the metadata contained in an external source of information, such as an EOModel (EOAccess). It defines a standard API for accessing the information in an external source. It also manages the registration of EOClassDescription objects in your application.
- The EOEnterpriseObject interface declares several EOClassDescription-related methods that define basic enterprise objects behavior, such as undo and validation. The EOCustomObject and EOGenericRecord classes implement the EOEnterpriseObject interface. An enterprise object class can either accept the default implementations by subclassing from EOCustomObject or it can provide its own implementation by overriding. This is discussed in more detail in the section "Using EOClassDescription".
Enterprise Objects Framework implements a default subclass of EOClassDescription in EOAccess, EOEntityClassDescription. EOEntityClassDescription extends the behavior of enterprise objects by deriving information about them (such as NULL constraints and referential integrity rules) from an associated EOModel.
For more information on using EOClassDescription, see the sections
- "How Does It Work?"
- "Using EOClassDescription"
- "EOEntityClassDescription"
- "The EOClassDescription's Delegate"
Constants
EOClassDescription defines the following int
constants:
EOClassDescription also defines string constants for the names of the notifications it posts. For more information, see the section "Notifications".
Method Types
- Managing EOClassDescriptions
- invalidateClassDescriptionCache
- registerClassDescription
- Getting EOClassDescriptions
- classDescriptionForClass
- classDescriptionForEntityName
- Creating new object instances
- createInstanceWithEditingContext
- Propagating delete
- propagateDeleteForObject
- Returning information from the EOClassDescription
- entityName
- attributeKeys
- classDescriptionForDestinationKey
- toManyRelationshipKeys
- toOneRelationshipKeys
- inverseForRelationshipKey
- ownsDestinationObjectsForRelationshipKey
- deleteRuleForRelationshipKey
- Performing validation
- validateObjectForDelete
- validateObjectForSave
- validateValueForKey
- Providing default characteristics for key display
- defaultFormatterForKey
- defaultFormatterForKeyPath
- displayNameForKey
- Handling newly inserted and newly fetched objects
- awakeObjectFromFetch
- awakeObjectFromInsertion
- Setting the delegate
- classDelegate
- setClassDelegate
- Getting an object's description
- userPresentableDescriptionForObject
- Getting fetch specifications
- fetchSpecificationNamed
Static Methods
classDelegate
public static Object
classDelegate
()
See Also: setClassDelegate
classDescriptionForClass
public static EOClassDescription
classDescriptionForClass
(Class aClass)
classDescriptionForEntityName
public static EOClassDescription
classDescriptionForEntityName
(String entityName)
invalidateClassDescriptionCache
public static void
invalidateClassDescriptionCache
()
Flushes the EOClassDescription cache. Because the EOModel objects in an application supply and register EOClassDescriptions on demand, the cache continues to be repopulated as needed after you invalidate it. (The EOModel class is defined in EOAccess.)
You'd use this method when a provider of EOClassDescriptions (such as an EOModel) has newly become available, or is about to go away. However, you should rarely need to directly invoke this
registerClassDescription
public static void
registerClassDescription
(
EOClassDescription description,
Class class)
setClassDelegate
public static void
setClassDelegate
(Object delegate)
See Also: classDelegate
Instance Methods
attributeKeys
public NSArray
attributeKeys
()
EOClassDescription's implementation of this method simply returns.
See Also: entityName, toOneRelationshipKeys, toManyRelationshipKeys
awakeObjectFromFetch
public void
awakeObjectFromFetch
(
EOEnterpriseObject object,
EOEditingContext anEditingContext)
awakeObjectFromInsertion
public void
awakeObjectFromInsertion
(
EOEnterpriseObject object,
EOEditingContext anEditingContext)
classDescriptionForDestinationKey
public EOClassDescription
classDescriptionForDestinationKey
(String detailKey)
movie.classDescriptionForDestinationKey("studio")
might return the class description for the Studio class. EOClassDescription's implementation of this method returns null.
createInstanceWithEditingContext
public EOEnterpriseObject
createInstanceWithEditingContext
(
EOEditingContext anEditingContext,
EOGlobalID globalID)
defaultFormatterForKey
public NSFormatter
defaultFormatterForKey
(String key)
Returns the default NSFormatter to use when parsing values for assignment to key. EOClassDescription's implementation returns null. The access layer's EOEntityClassDescription's implementation returns an NSFormatter based on the Java value class specified for key in the associated model file. Code that creates a user interface, like a wizard, can use this method to assign formatters to user interface elements.
defaultFormatterForKeyPath
public NSFormatter
defaultFormatterForKey
(String key)
Similar to defaultFormatterForKey
,
except this method traverses keyPath and
returns the formatter for the key at the end of the path (using defaultFormatterForKey
).
deleteRuleForRelationshipKey
public int
deleteRuleForRelationshipKey
(String relationshipKey)
EOClassDescription's implementation of this method returns the delete rule EODeleteRuleNullify. In the common case, the delete rule for an enterprise object is defined in its EOModel. (The EOModel class is defined in EOAccess.)
See Also: propagateDeleteWithEditingContext (EOEnterpriseObject)
displayNameForKey
public String
displayNameForKey
(String key)
Returns the default string to use in the user interface when displaying key. By convention, lowercase words are capitalized (for example, "revenue" becomes "Revenue"), and spaces are inserted into words with mixed case (for example, "firstName" becomes "First Name"). This method is useful if you're creating a user interface from only a class description, such as with a wizard or a Direct To Web application.
entityName
public String
entityName
()
See Also: attributeKeys, toOneRelationshipKeys, toManyRelationshipKeys
fetchSpecificationNamed
Overridden by subclasses to return the fetch specification associated with name. For example, the access layer's EOEntityClassDescription returns the fetch specification in its EOEntity named name (if any). EOClassDescription's implementation returnsnil
.inverseForRelationshipKey
public String
inverseForRelationshipKey
(String relationshipKey)
employee.inverseForRelationshipKey("department");
returns the string "employees".
EOClassDescription's implementation of this method returns null.
ownsDestinationObjectsForRelationshipKey
public boolean
ownsDestinationObjectsForRelationshipKey
(String relationshipKey)
propagateDeleteForObject
public void
propagateDeleteForObject
(
EOEnterpriseObject object,
EOEditingContext anEditingContext)
See Also: deleteRuleForRelationshipKey
toManyRelationshipKeys
public NSArray
toManyRelationshipKeys
()
See Also: entityName, toOneRelationshipKeys, attributeKeys
toOneRelationshipKeys
public NSArray
toOneRelationshipKeys
()
See Also: entityName, toManyRelationshipKeys, attributeKeys
userPresentableDescriptionForObject
public String
userPresentableDescriptionForObject
(Object anObject)
Returns a short (no longer than 60 characters) description of anObject based on its data. This method enumerates anObject's attributeKeys and returns each attribute's value, separated by commas and with the default formatter applied for numbers and dates.
validateObjectForDelete
public void
validateObjectForDelete
(EOEnterpriseObject object)
validateObjectForSave
public void
validateObjectForSave
(EOEnterpriseObject object)
validateValueForKey
public Object
validateValueForKey
(
Object value,
String key)
An enterprise object performs custom
attribute specific validation with a method of the form validate Key
.
See the EOValidation interface specification
for more information.
Notifications
The following notifications are declared by EOClassDescription and posted by enterprise objects in your application.
ClassDescriptionNeededForClassNotification
public static final String ClassDescriptionNeededForClassNotification
classDescription
message
(for example, when changes to the object are being saved to the
database), it posts ClassDescriptionNeededForClassNotification
to
notify observers that a class description is needed. The observer
then locates the appropriate class description and registers it
in the application. By default, EOModel objects are registered as
observers for this notification and register EOClassDescriptions
on demand.Notification Object | Enterprise object class |
userInfo Dictionary | None |
ClassDescriptionNeededForEntityNameNotification
public static final String ClassDescriptionNeededForEntityNameNotification
Notification Object | Entity name (String) |
userInfo Dictionary | None |