org.hydrateframework.event
Class ObjectAccessEventHandler.WaitForPopulationEventHandler
java.lang.Object
   org.hydrateframework.event.ObjectAccessEventHandler.WaitForPopulationEventHandler
org.hydrateframework.event.ObjectAccessEventHandler.WaitForPopulationEventHandler
- All Implemented Interfaces: 
- ObjectAccessEventHandler
- Enclosing interface:
- ObjectAccessEventHandler
- public static class ObjectAccessEventHandler.WaitForPopulationEventHandler 
- extends java.lang.Object- implements ObjectAccessEventHandler
 
 
 
| Method Summary | 
|  boolean | attributeNotLoaded(HydrateObject object,
                   java.lang.String attribute)This event method is called when an attempt is made to access an attribute
 of an object that has not been loaded.
 | 
|  boolean | collectionNotLoaded(HydrateObject object,
                    java.lang.String attribute)This event method is called when an attempt is made to access a collection attribute
 of an object that has not been loaded.
 | 
|  java.util.Collection | getWeakCollection(HydrateObject obj,
                  java.lang.String attr,
                  java.lang.Class collClass)This method is needed to resolve the obscure, but tricky relationship between autoload
 references and lazy loading.
 | 
 
| Methods inherited from class java.lang.Object | 
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
 
ObjectAccessEventHandler.WaitForPopulationEventHandler
public ObjectAccessEventHandler.WaitForPopulationEventHandler()
attributeNotLoaded
public boolean attributeNotLoaded(HydrateObject object,
                                  java.lang.String attribute)
- Description copied from interface: ObjectAccessEventHandler
- This event method is called when an attempt is made to access an attribute
 of an object that has not been loaded.  Implementors of this method have 
 an opportunity to do something about the fact that the attribute was
 not populated such as setting it to a default value, reading it from a database
 or waiting for it to get populated by another thread
 
- 
- Specified by:
- attributeNotLoadedin interface- ObjectAccessEventHandler
 
- 
- Parameters:
- object- the object that had an attribute that was not loaded
- attribute- the identifier corresponding to the attribute that was not set.
- Returns:
- true if the calling code should check to see if the attribute is not set and,
 if not call this method again.  False if the calling code should check to see
 if the attribute is not set and throw a NotLoadedException if not.
 
collectionNotLoaded
public boolean collectionNotLoaded(HydrateObject object,
                                   java.lang.String attribute)
- Description copied from interface: ObjectAccessEventHandler
- This event method is called when an attempt is made to access a collection attribute
 of an object that has not been loaded.
 
- 
- Specified by:
- collectionNotLoadedin interface- ObjectAccessEventHandler
 
- 
- Parameters:
- object- the object that had an attribute that was not loaded
- attribute- the identifier corresponding to the collection attribute that was not set.
- Returns:
- true if the calling code should check to see if the attribute is not set and,
 if not call this method again.  False if the calling code should check to see
 if the attribute is not set and throw a NotLoadedException if not.
- See Also:
- ObjectAccessEventHandler.attributeNotLoaded(HydrateObject, String)
 
getWeakCollection
public java.util.Collection getWeakCollection(HydrateObject obj,
                                              java.lang.String attr,
                                              java.lang.Class collClass)
- Description copied from interface: ObjectAccessEventHandler
- This method is needed to resolve the obscure, but tricky relationship between autoload
 references and lazy loading.  Our problem is that on loading objects we often implicitly
 fix up back references to unloaded collections.  However, this gets in the way of the lazy
 loading of collections because either the collection will try and load when the back
 reference is created, or it will block subsequent implicit loading of the full
 collection afterwards.  The solution is to permit weakly referenced collections that
 are not part of the class until explicity created but can keep track of these back
 references in the meantime.  This method requests the creation (or resolution) of such
 a weakly referenced collection.  These collections should always disappear as soon as
 the object they belong to is eligible for garbage collection
 
- 
- Specified by:
- getWeakCollectionin interface- ObjectAccessEventHandler
 
- 
- Parameters:
- obj- the hydrate object that needs a collection.  Don't even start thinking about 
 getting this to work with non-Hydrate objects.
- attr- the name of the attribute (must be the static reference from the interface)
- collClass- the class of the collection that would be created if there is none 
 available.
- Returns:
- this method should return null if it doesn't implement collectionNotLoaded i.e.
 doesn't concern itself with lazy loading of collections.  If it does, it must return a
 collection that 'belongs' to the given object.  In other words, subsequent calls to this
 method must return the same collection, but that collection must be eligible for garbage
 collection when the object reference goes out of scope.
 
Copyright © 2000 The Hydrate Project. All Rights Reserved.