java.lang.Object
org.apache.wicket.util.watch.ModificationWatcher
- All Implemented Interfaces:
IModificationWatcher
- Direct Known Subclasses:
Nio2ModificationWatcher
Monitors one or more
IModifiable
objects, calling a IChangeListener
when a given object's modification time changes.- Since:
- 1.2.6
- Author:
- Jonathan Locke
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static final class
Container class for holding modifiable entries to watch. -
Constructor Summary
ConstructorDescriptionDefault constructor for two-phase construction.ModificationWatcher
(Duration pollFrequency) Constructor that accepts aDuration
argument representing the poll frequency. -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
add
(IModifiable modifiable, IChangeListener<IModifiable> listener) Adds anIModifiable
object and anIChangeListener
object to call when the modifiable object is modified.protected void
Checks which IModifiables were modified and notifies their listenersvoid
destroy()
Stops thisModificationWatcher
.final Set<IModifiable>
Retrieves a key set of allIModifiable
objects currently being monitored.remove
(IModifiable modifiable) Removes all entries associated with anIModifiable
object.void
Starts watching at a givenDuration
polling rate.
-
Constructor Details
-
ModificationWatcher
public ModificationWatcher()Default constructor for two-phase construction. -
ModificationWatcher
Constructor that accepts aDuration
argument representing the poll frequency.- Parameters:
pollFrequency
- how often to check onIModifiable
s
-
-
Method Details
-
add
Description copied from interface:IModificationWatcher
Adds anIModifiable
object and anIChangeListener
object to call when the modifiable object is modified.- Specified by:
add
in interfaceIModificationWatcher
- Parameters:
modifiable
- anIModifiable
object to monitorlistener
- anIChangeListener
to call if theIModifiable
object is modified- Returns:
true
if the set did not already contain the specified element
-
remove
Description copied from interface:IModificationWatcher
Removes all entries associated with anIModifiable
object.- Specified by:
remove
in interfaceIModificationWatcher
- Parameters:
modifiable
- anIModifiable
object- Returns:
- the
IModifiable
object that was removed, elsenull
-
start
Description copied from interface:IModificationWatcher
Starts watching at a givenDuration
polling rate.- Specified by:
start
in interfaceIModificationWatcher
- Parameters:
pollFrequency
- the polling rateDuration
-
checkModified
Checks which IModifiables were modified and notifies their listeners -
destroy
Description copied from interface:IModificationWatcher
Stops thisModificationWatcher
.- Specified by:
destroy
in interfaceIModificationWatcher
-
getEntries
Description copied from interface:IModificationWatcher
Retrieves a key set of allIModifiable
objects currently being monitored.- Specified by:
getEntries
in interfaceIModificationWatcher
- Returns:
- a
Set
of allIModifiable
entries currently maintained
-