WebObjects 5.2

com.webobjects.eocontrol
Interface EOFaulting

All Known Subinterfaces:
EODeferredFaulting, EOEnterpriseObject

public interface EOFaulting

The EOFaulting interface together with the EOFaultHandler class forms a general mechanism for postponing an object's initialization until it is actually needed. In it's preinitialization state, an EOFaulting object is known as a fault. When the object is sent a message to which it can't respond without initializing, it fires a fault handler to finish initializing. Faults are most commonly used by the EOAccess layer to represent an object not yet fetched from the database, but that must nonetheless exist as an instance in the application, typically because it's the destination of a relationship. Consequently, a fault typically fires when an attempt is made to access any of its data. In this case, firing a fault involves fetching the object's data.

The default implementations of EOFaulting in EOCustomObject and EOGenericRecord are sufficient for most purposes. If you need custom faulting behavior, you typically create a subclass of EOFaultHandler to accommodate different means of converting faults into regular objects.

See Also:
EOFaultHandler

Method Summary
 void clearFault()
          Restores the receiver to its status prior to the turnIntoFault message that turned the object into a fault.
 EOFaultHandler faultHandler()
          Returns the EOFaultHandler that will help the reciever to fire.
 boolean isFault()
          Returns whether the receiver is a fault or not.
 void turnIntoFault(EOFaultHandler handler)
          Converts the receiver into a fault, assigning handler as the object that stores how to retrieve its original state and later converts the fault back into a normal object (typically by fetching data from an external data source).
 void willRead()
          Fills the receiver with values fetched from the database.
 

Method Detail

clearFault

public void clearFault()
Restores the receiver to its status prior to the turnIntoFault message that turned the object into a fault. Throws an exception if the receiver isn't a fault. You rarely use this method. Ususally, it is invoked by an EOFaultHandler during the process of firing the fault.
See Also:
turnIntoFault(EOFaultHandler), EOFaultHandler.clearFault(Object)

faultHandler

public EOFaultHandler faultHandler()
Returns the EOFaultHandler that will help the reciever to fire. Returns null if the receiver isn't a fault.
Returns:
the fault handler that will help the receiver to fire; null if the receiver isn't a fault
See Also:
EOFaultHandler.handlerForFault(Object)

isFault

public boolean isFault()
Returns whether the receiver is a fault or not.
Returns:
true if the receiver is a fault; false otherwise
See Also:
EOFaultHandler.isFault(Object)

turnIntoFault

public void turnIntoFault(EOFaultHandler handler)
Converts the receiver into a fault, assigning handler as the object that stores how to retrieve its original state and later converts the fault back into a normal object (typically by fetching data from an external data source). The receiver becomes the owner of handler.
Parameters:
handler - the fault handler
See Also:
EOFaultHandler.makeObjectIntoFault(Object, EOFaultHandler)

willRead

public void willRead()

Fills the receiver with values fetched from the database. Before the application attempts to message an object, you must ensure that it has been filled with its data. To do this, enterprise objects invoke the method willRead prior to any attempt to access the object's state, most typically in "get" methods such as the following:

  public String roleName() {
      willRead();
      return roleName;
  }
 

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

Copyright © 2003 Apple Computer, Inc.