public class ModificationWatcher extends Object implements IModificationWatcher
IModifiable objects, calling a IChangeListener when a given object's modification time changes.| Modifier and Type | Class and Description |
|---|---|
protected static class |
ModificationWatcher.Entry
Container class for holding modifiable entries to watch.
|
| Constructor and Description |
|---|
ModificationWatcher()
Default constructor for two-phase construction.
|
ModificationWatcher(Duration pollFrequency)
Constructor that accepts a
Duration argument representing the poll frequency. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(IModifiable modifiable,
IChangeListener listener)
Adds an
IModifiable object and an IChangeListener object to call
when the modifiable object is modified. |
protected void |
checkModified()
Checks which IModifiables were modified and notifies their listeners
|
void |
destroy()
Stops this
ModificationWatcher. |
Set<IModifiable> |
getEntries()
Retrieves a key set of all
IModifiable objects currently being monitored. |
IModifiable |
remove(IModifiable modifiable)
Removes all entries associated with an
IModifiable object. |
void |
start(Duration pollFrequency)
Starts watching at a given
Duration polling rate. |
public ModificationWatcher()
public ModificationWatcher(Duration pollFrequency)
Duration argument representing the poll frequency.pollFrequency - how often to check on IModifiablespublic final boolean add(IModifiable modifiable, IChangeListener listener)
IModificationWatcherIModifiable object and an IChangeListener object to call
when the modifiable object is modified.add in interface IModificationWatchermodifiable - an IModifiable object to monitorlistener - an IChangeListener to call if the IModifiable object is
modifiedtrue if the set did not already contain the specified elementpublic IModifiable remove(IModifiable modifiable)
IModificationWatcherIModifiable object.remove in interface IModificationWatchermodifiable - an IModifiable objectIModifiable object that was removed, else nullpublic void start(Duration pollFrequency)
IModificationWatcherDuration polling rate.start in interface IModificationWatcherpollFrequency - the polling rate Durationprotected void checkModified()
public void destroy()
IModificationWatcherModificationWatcher.destroy in interface IModificationWatcherpublic final Set<IModifiable> getEntries()
IModificationWatcherIModifiable objects currently being monitored.getEntries in interface IModificationWatcherSet of all IModifiable entries currently maintainedCopyright © 2006-2012 Apache Software Foundation. All Rights Reserved.