org.hydrateframework.event
Class ObjectLoadErrorHandler.SmartLoader
java.lang.Object
org.hydrateframework.event.ObjectLoadErrorHandler.SmartLoader
- All Implemented Interfaces:
- ObjectLoadErrorHandler
- Enclosing interface:
- ObjectLoadErrorHandler
public static class ObjectLoadErrorHandler.SmartLoader
- extends java.lang.Object
- implements ObjectLoadErrorHandler
Field Summary |
protected static java.util.WeakHashMap |
m_ctxMap
|
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. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
m_ctxMap
protected static java.util.WeakHashMap m_ctxMap
ObjectLoadErrorHandler.SmartLoader
public ObjectLoadErrorHandler.SmartLoader(ObjectContext ctx)
handleKeyClash
public java.lang.Object handleKeyClash(java.lang.Object existingObject,
java.lang.Object newObject,
java.lang.Class keyClass)
throws SaveException
- Description copied from interface:
ObjectLoadErrorHandler
- 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.
- Specified by:
handleKeyClash
in interface ObjectLoadErrorHandler
- Parameters:
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
handleClassMismatch
public java.lang.Object handleClassMismatch(java.lang.Object existingObject,
java.lang.Class newClass,
ObjectKey newKey)
throws SaveException
- Description copied from interface:
ObjectLoadErrorHandler
- 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.
- Specified by:
handleClassMismatch
in interface ObjectLoadErrorHandler
- Parameters:
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
Copyright © 2000 The Hydrate Project. All Rights Reserved.