WebObjects 5.4.2

com.webobjects.eoaccess
Interface EOModelGroup.Delegate

Enclosing class:
EOModelGroup

public static interface EOModelGroup.Delegate

This interface defines a delegate to EOModelGroup to allow instances to modify how the model group finds and loads models. There is also an EOModelGroup class delegate that can be implemented to change the creation of the default model group.

See Also:
EOModelGroup.ClassDelegate

Method Summary
 Class classForObjectWithGlobalID(EOEntity entity, EOGlobalID gid)
          Used to fine-tune inheritance.
 Class failedToLookupClassNamed(EOEntity entity, String className)
          Invoked when the class name specified for entity cannot be found at runtime.
 EOEntity relationshipFailedToLookupDestinationWithName(EORelationship relationship, String name)
          Invoked when relationship is being loaded and the destination entity identified by name in the model file cannot be found in the model group.
 EORelationship relationshipForRow(EOEntity entity, NSDictionary dictionary, EORelationship relationship)
          Invoked when relationships are instantiated for a newly fetched object.
 EOEntity subEntityForEntity(EOEntity entity, NSDictionary dic)
          Allows the delegate to fine-tune inheritance by returning the sub-entity of entity from which an object should be fetched based on the primary key in dic.
 

Method Detail

relationshipForRow

EORelationship relationshipForRow(EOEntity entity,
                                  NSDictionary dictionary,
                                  EORelationship relationship)
Invoked when relationships are instantiated for a newly fetched object. Allows the delegate the opportunity to substitute a different relationship than relationship for the specified entity. dictionary is the snapshot of the database row for the newly fetched object. Should return relationship to leave the default behavior unchanged, or a different EORelationship object as appropriate.

Parameters:
entity - The entity for the newly fetched enterprise object.
dictionary - The database snapshot for the Enterprise Object associated with entity.
relationship - The default relationship instantiated for entity.
Returns:
Should return the relationship to be associated with entity (either relationship or some other relationship).

subEntityForEntity

EOEntity subEntityForEntity(EOEntity entity,
                            NSDictionary dic)
Allows the delegate to fine-tune inheritance by returning the sub-entity of entity from which an object should be fetched based on the primary key in dic.

Parameters:
entity - An EOEntity.
dic - The snapshot of a database row from which to extract the primary key of the object to fetch.
Returns:
The sub-entity of entity which should fetch the object based on the primary key in dic.

failedToLookupClassNamed

Class failedToLookupClassNamed(EOEntity entity,
                               String className)
Invoked when the class name specified for entity cannot be found at runtime. The delegate can take action to provide a different class to associate with entity. If the delegate cannot provide an alternate class, or if there is no delegate, EOGenericRecord is used as entity's class.

Parameters:
entity - An EOEntity object.
className - The class name specified for entity, which the runtime system has been unable to locate.
Returns:
Should return a class to associate with entity, or null if unable to provide an alternate class.

classForObjectWithGlobalID

Class classForObjectWithGlobalID(EOEntity entity,
                                 EOGlobalID gid)
Used to fine-tune inheritance. The delegate can take action to substitute a different class for the object identified by the globalID gid in place of the one specified in entity. If the delegate cannot provide an alternate class, or if there is no delegate, EOGenericRecord is used.

Parameters:
entity - An EOEntity object.
gid - The globalID of an Enterprise Object.
Returns:
Should return a class to associate with the object identifed by gid, or null if unable to provide an alternate class.

relationshipFailedToLookupDestinationWithName

EOEntity relationshipFailedToLookupDestinationWithName(EORelationship relationship,
                                                       String name)
Invoked when relationship is being loaded and the destination entity identified by name in the model file cannot be found in the model group. This most often occurs when a model references entities in another model file that can't be found.

The delegate can implement this method to return a different destination entity to set for relationship, or null to set the destination entity to null. If the delegate doesn't implement this method, an exception is thrown by the Enterprise Objects Framework.

Parameters:
relationship - A relationship whose destination entity cannot be located during loading.
name - The name of the destination entity defined for relationship in the EOModel.
Returns:
Should return an Enterprise Object to set as relationship's destination entity, or null.

Last updated June 2008

Copyright © 2000-2008 Apple Inc.