|
WebObjects 5.2 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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.
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 |
public void clearFault()
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.turnIntoFault(EOFaultHandler)
,
EOFaultHandler.clearFault(Object)
public EOFaultHandler faultHandler()
null
if the receiver isn't a fault.null
if the receiver isn't a faultEOFaultHandler.handlerForFault(Object)
public boolean isFault()
true
if the receiver is a fault; false
otherwiseEOFaultHandler.isFault(Object)
public void turnIntoFault(EOFaultHandler handler)
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
.handler
- the fault handlerEOFaultHandler.makeObjectIntoFault(Object, EOFaultHandler)
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. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |