org.hydrateframework.event
Interface ObjectLoadErrorHandler

All Known Implementing Classes:
ObjectLoadErrorHandler.IntolerantLoader, ObjectLoadErrorHandler.SmartLoader

public interface ObjectLoadErrorHandler


Nested Class Summary
static class ObjectLoadErrorHandler.IntolerantLoader
           
static class ObjectLoadErrorHandler.SmartLoader
           
 
Method Summary
 java.lang.Object handleClassMismatch(java.lang.Object existingObject, java.lang.Class newClass, ObjectKey newKey)
          This method is called when a query indicates that an existing object is really of a more specialized class than the concrete class that is currently instantiated.
 java.lang.Object handleKeyClash(java.lang.Object existingObject, java.lang.Object newObject, java.lang.Class keyClass)
          This method is called when an attempt is made to add a duplicate object to an index.
 

Method Detail

handleClassMismatch

java.lang.Object handleClassMismatch(java.lang.Object existingObject,
                                     java.lang.Class newClass,
                                     ObjectKey newKey)
                                     throws SaveException
This method is called when a query indicates that an existing object is really of a more specialized class than the concrete class that is currently instantiated. This situation may happen when an object is first loaded as if it were a base class and later in another operation resolved to its true class.

Parameters:
ctx - the object context into which the load is taking place
existingObject - the base class object that has already been created.
newClass - the more specialized class of object that has now been identified.
Returns:
the object to use or null to pass responsibility to the next handler. If nothing handles this method then a warning is printed and the base class is used.
Throws:
SaveException

handleKeyClash

java.lang.Object handleKeyClash(java.lang.Object existingObject,
                                java.lang.Object newObject,
                                java.lang.Class keyClass)
                                throws SaveException
This method is called when an attempt is made to add a duplicate object to an index. This can happen if two queries are loading objects using different keys and The load via the first key does not populate the second key, but the load via the second key does populate the first, or the underlying data has inconsistent keys. The first problem can usually be overcome by changing the order of assemblers in the query runner, but it is often useful to handle the problem manually.

Parameters:
ctx - the object context into which the load is taking place
existingObject - The original object that is already indexed.
newObject - The object, different from the existing object that has the same key.
keyClass - The class of key which is the same for both objects.
Returns:
the object to use is the key or null to pass responsibility to the next handler. If nothing handles this method then a warning is printed and the new object is used.
Throws:
SaveException


Copyright © 2000 The Hydrate Project. All Rights Reserved.