|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.ojb.broker.core.proxy.CollectionProxyDefaultImpl
public class CollectionProxyDefaultImpl
A place holder for a whole collection to support deferred loading of relationships. The complete collection is loaded on access to the data.
| Constructor Summary | |
|---|---|
CollectionProxyDefaultImpl(PBKey brokerKey,
Class collClass,
Query query)
Creates a new collection proxy that uses the given collection type. |
|
CollectionProxyDefaultImpl(PBKey brokerKey,
Query query)
Creates a new collection proxy (uses RemovalAwareCollection
as the collection class). |
|
| Method Summary | |
|---|---|
boolean |
add(Object o)
|
boolean |
addAll(Collection c)
|
void |
addListener(CollectionProxyListener listener)
Adds a listener to this collection. |
protected void |
afterLoading()
Notifies all listeners that the data has been loaded. |
void |
afterStore(PersistenceBroker broker)
A callback method to implement 'removal-aware' (track removed objects and delete them by its own) collection implementations. |
protected void |
beforeLoading()
Notifies all listeners that the data is about to be loaded. |
void |
clear()
Clears the proxy. |
boolean |
contains(Object o)
|
boolean |
containsAll(Collection c)
|
protected PersistenceBroker |
getBroker()
Acquires a broker instance. |
PBKey |
getBrokerKey()
Returns the key of the persistence broker used by this collection. |
Class |
getCollectionClass()
Returns the collection type. |
Collection |
getData()
Returns the collection data, load it if not already done so. |
protected Object |
getProfileKey()
Returns the metadata profile key used when creating this proxy. |
Query |
getQuery()
Returns the defining query. |
boolean |
isEmpty()
|
boolean |
isLoaded()
Determines whether the collection data already has been loaded from the database. |
Iterator |
iterator()
|
protected Collection |
loadData()
Loads the data from the database. |
protected void |
loadProfileIfNeeded()
Reactivates metadata profile used when creating proxy, if needed. |
protected int |
loadSize()
Determines the number of elements that the query would return. |
void |
ojbAdd(Object anObject)
Adds a single object to the Collection. |
void |
ojbAddAll(ManageableCollection otherCollection)
Adds another collection to this collection. |
Iterator |
ojbIterator()
Returns an iterator over all elements in the collection. |
protected void |
releaseBroker(PersistenceBroker broker)
Release the broker instance. |
boolean |
remove(Object o)
|
boolean |
removeAll(Collection c)
|
void |
removeListener(CollectionProxyListener listener)
Removes the given listener from this collecton. |
boolean |
retainAll(Collection c)
|
protected void |
setBrokerKey(PBKey brokerKey)
Sets the key of the persistence broker used by this collection. |
protected void |
setCollectionClass(Class collClass)
Sets the collection type. |
void |
setData(Collection data)
Sets the collection data. |
void |
setProfileKey(Object profileKey)
Sets the metadata profile key used when creating this proxy. |
protected void |
setQuery(Query query)
Sets the defining query. |
protected void |
setSize(int size)
Sets the size internally. |
int |
size()
|
Object[] |
toArray()
|
Object[] |
toArray(Object[] a)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.util.Collection |
|---|
equals, hashCode |
| Constructor Detail |
|---|
public CollectionProxyDefaultImpl(PBKey brokerKey,
Query query)
RemovalAwareCollection
as the collection class).
brokerKey - The key of the persistence brokerquery - The defining query
public CollectionProxyDefaultImpl(PBKey brokerKey,
Class collClass,
Query query)
brokerKey - The key of the persistence brokercollClass - The collection typequery - The defining query| Method Detail |
|---|
protected void loadProfileIfNeeded()
_perThreadDescriptorsEnabled since the profile never
needs to be reloaded if not using pre-thread metadata changes.
public boolean isLoaded()
isLoaded in interface CollectionProxytrue if the data is already loaded
protected int loadSize()
throws PersistenceBrokerException
PersistenceBrokerExceptionprotected void setSize(int size)
size - The new size
protected Collection loadData()
throws PersistenceBrokerException
PersistenceBrokerExceptionprotected void beforeLoading()
protected void afterLoading()
public int size()
size in interface CollectionCollection.size()public boolean isEmpty()
isEmpty in interface CollectionCollection.isEmpty()public boolean contains(Object o)
contains in interface CollectionCollection.contains(Object)public Iterator iterator()
iterator in interface Iterableiterator in interface CollectionCollection.iterator()public Object[] toArray()
toArray in interface CollectionCollection.toArray()public Object[] toArray(Object[] a)
toArray in interface CollectionCollection.toArray(Object[])public boolean add(Object o)
add in interface CollectionCollection.add(Object)public boolean remove(Object o)
remove in interface CollectionCollection.remove(Object)public boolean containsAll(Collection c)
containsAll in interface CollectionCollection.containsAll(Collection)public boolean addAll(Collection c)
addAll in interface CollectionCollection.addAll(Collection)public boolean removeAll(Collection c)
removeAll in interface CollectionCollection.removeAll(Collection)public boolean retainAll(Collection c)
retainAll in interface CollectionCollection.retainAll(Collection)public void clear()
clear in interface CollectionCollection.clear()public Query getQuery()
protected void setQuery(Query query)
query - The queryprotected void releaseBroker(PersistenceBroker broker)
protected PersistenceBroker getBroker()
throws PBFactoryException
PBFactoryExceptionpublic Collection getData()
public void setData(Collection data)
data - The datapublic Class getCollectionClass()
protected void setCollectionClass(Class collClass)
collClass - The collection typepublic void ojbAdd(Object anObject)
ManageableCollection
ojbAdd in interface ManageableCollectionanObject - The object to addManageableCollection.ojbAdd(Object)public void ojbAddAll(ManageableCollection otherCollection)
ManageableCollection
ojbAddAll in interface ManageableCollectionotherCollection - The added collectionManageableCollection.ojbAddAll(ManageableCollection)public Iterator ojbIterator()
ManageableCollection
ojbIterator in interface ManageableCollectionManageableCollection.ojbIterator()
public void afterStore(PersistenceBroker broker)
throws PersistenceBrokerException
ManageableCollection
afterStore in interface ManageableCollectionbroker - The persistence broker
PersistenceBrokerExceptionManageableCollection.afterStore(PersistenceBroker broker)public PBKey getBrokerKey()
protected void setBrokerKey(PBKey brokerKey)
brokerKey - The key of the brokerprotected Object getProfileKey()
public void setProfileKey(Object profileKey)
profileKey - the metadata profile keypublic void addListener(CollectionProxyListener listener)
addListener in interface CollectionProxylistener - The listener to addpublic void removeListener(CollectionProxyListener listener)
removeListener in interface CollectionProxylistener - The listener to remove
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||