public abstract class AbstractPersistentCollection<C> extends java.lang.Object implements PersistentCollection<C>
PersistentCollection.ChangeListener<C>, PersistentCollection.InitializationCallback<C>, PersistentCollection.InitializationListener<C>, PersistentCollection.Initializer<C>| Modifier | Constructor and Description |
|---|---|
protected |
AbstractPersistentCollection() |
| Modifier and Type | Method and Description |
|---|---|
void |
addListener(PersistentCollection.ChangeListener<C> listener)
Register a change listener
|
void |
addListener(PersistentCollection.InitializationListener<C> listener)
Register a initialization listener
|
protected boolean |
checkInitializedRead() |
protected void |
checkInitializedWrite() |
void |
clearDirty()
Clear the dirty state of the collection
|
PersistentCollection<C> |
clone(boolean uninitialize)
Clone a persistent collection
|
protected abstract PersistentCollectionSnapshot |
createSnapshot(java.lang.Object io,
boolean forReading) |
void |
dirty()
Mark the collection as dirty
|
protected abstract void |
doInitialize(C content,
boolean empty) |
protected java.lang.ClassLoader |
getClassLoader() |
protected C |
getCollection() |
java.lang.String |
getDetachedState() |
Loader<C> |
getLoader()
Loader for the collection
|
protected void |
init(C collection,
java.lang.String detachedState,
boolean dirty) |
void |
initialize(C content,
PersistentCollection.Initializer<C> initializer)
Mark the collection as initialized, called after the content is loaded
|
void |
initializing()
Mark the collection as currently initializing so next access do not trigger loading
|
boolean |
isDirty()
Is the collection dirty ?
|
void |
readExternal(java.io.ObjectInput in) |
void |
removeListener(PersistentCollection.ChangeListener<C> listener)
Unregister a change listener
|
void |
removeListener(PersistentCollection.InitializationListener<C> listener)
Unregister a initialization listener
|
void |
setLoader(Loader<C> loader)
Set a loader for the collection
|
java.lang.String |
toString() |
void |
uninitialize()
Unload the collection and unset its initialized state
|
protected abstract void |
updateFromSnapshot(java.io.ObjectInput in,
PersistentCollectionSnapshot snapshot) |
boolean |
wasInitialized()
Was the collection was initialized
|
void |
withInitialized(PersistentCollection.InitializationCallback<C> callback)
Execute the specified callback after ensuring the collection has been loaded
If it was not loaded, the callack is called asynchronously after loading is complete
|
void |
writeExternal(java.io.ObjectOutput out) |
protected void init(C collection, java.lang.String detachedState, boolean dirty)
public Loader<C> getLoader()
PersistentCollectiongetLoader in interface PersistentCollection<C>public void setLoader(Loader<C> loader)
PersistentCollectionsetLoader in interface PersistentCollection<C>loader - loader that will be called when a lazy collection is accessedprotected boolean checkInitializedRead()
protected void checkInitializedWrite()
protected C getCollection()
public java.lang.String getDetachedState()
protected java.lang.ClassLoader getClassLoader()
public boolean wasInitialized()
PersistentCollectionwasInitialized in interface PersistentCollection<C>public boolean isDirty()
PersistentCollectionisDirty in interface PersistentCollection<C>public void dirty()
PersistentCollectiondirty in interface PersistentCollection<C>public void clearDirty()
PersistentCollectionclearDirty in interface PersistentCollection<C>public PersistentCollection<C> clone(boolean uninitialize)
PersistentCollectionclone in interface PersistentCollection<C>uninitialize - true to get an uninitialized clone of a lazy collectionprotected abstract PersistentCollectionSnapshot createSnapshot(java.lang.Object io, boolean forReading)
protected abstract void updateFromSnapshot(java.io.ObjectInput in,
PersistentCollectionSnapshot snapshot)
public void writeExternal(java.io.ObjectOutput out)
throws java.io.IOException
writeExternal in interface java.io.Externalizablejava.io.IOExceptionpublic void readExternal(java.io.ObjectInput in)
throws java.io.IOException,
java.lang.ClassNotFoundException
readExternal in interface java.io.Externalizablejava.io.IOExceptionjava.lang.ClassNotFoundExceptionpublic java.lang.String toString()
toString in class java.lang.Objectpublic void addListener(PersistentCollection.ChangeListener<C> listener)
PersistentCollectionaddListener in interface PersistentCollection<C>listener - listenerpublic void removeListener(PersistentCollection.ChangeListener<C> listener)
PersistentCollectionremoveListener in interface PersistentCollection<C>listener - listenerpublic void addListener(PersistentCollection.InitializationListener<C> listener)
PersistentCollectionaddListener in interface PersistentCollection<C>listener - listenerpublic void removeListener(PersistentCollection.InitializationListener<C> listener)
PersistentCollectionremoveListener in interface PersistentCollection<C>listener - listenerpublic void initializing()
PersistentCollectioninitializing in interface PersistentCollection<C>public void initialize(C content, PersistentCollection.Initializer<C> initializer)
PersistentCollectioninitialize in interface PersistentCollection<C>protected abstract void doInitialize(C content, boolean empty)
public void uninitialize()
PersistentCollectionuninitialize in interface PersistentCollection<C>public void withInitialized(PersistentCollection.InitializationCallback<C> callback)
PersistentCollectionwithInitialized in interface PersistentCollection<C>callback - callback method to execute