Classes implement this interface in order to be notified of changes to a
feature toggle, and to take action when those changes occur.
Most code that is interested in a feature toggle can simply refer to the
ToggleMonitor
directly and check the status of their feature. For
code that cannot do this, or that wants to otherwise translate or take
action when the status of a feature toggle changes, this interface provides
that capability.
To use this interface:
- Create an implementation of this interface, which:
- Returns the name of the feature toggle it refers to when getToggleName()
is called
- Implements in the onStatusCheck() method the desired functionality that
should take place when the feature toggle state is checked
- Register an instance of that implementation with a
ToggleMonitorManager
.
The
ToggleMonitorManager
will then call this class every time the
feature toggle referenced by the toggle name is checked, and will send the
toggle status in the call to onStatusCheck().