public interface NutDaoListener
This interface represents a listener which expects to be notified of changes when they occur on a particular nut.
To be notified, it must be registered to the NutDao
thanks to its NutDao.observe(String, NutDaoListener...)
method.
Modifier and Type | Method and Description |
---|---|
Object |
getFactory()
An arbitrary object which helps to know how the listener has been created.
|
boolean |
isDisposable()
Indicates if this listener should be removed from the observable object when a call to
polling(String, java.util.Set) or nutPolled(NutDao, String, Long) returns false . |
boolean |
nutPolled(NutDao dao,
String path,
Long timestamp)
Called when a nut has been polled.
|
boolean |
polling(String pattern,
Set<String> paths)
When a DAO performs a polling operation, this method is called first with all path which are going to be polled.
|
boolean polling(String pattern, Set<String> paths)
When a DAO performs a polling operation, this method is called first with all path which are going to be polled.
The paths are computed thanks to their representation (regex or not) specified when this listener has been registered to the observable.
If the listener returns false
, the observable will stop notifying it only during the polling
operation.
pattern
- the pattern (actually the path itself or a regex) corresponding to the pathspaths
- all the real paths which are going to be polledfalse
if polling should not be done, true
otherwiseboolean nutPolled(NutDao dao, String path, Long timestamp)
Called when a nut has been polled.
When the observable object checks in one operation the changes on a set of nuts, the listener could notifies the observable to stop notifying it only during the operation.
dao
- the DAO which pollspath
- the polled pathtimestamp
- the timestamp retrieved when poling the nuttrue
if this listener needs to be notified of any other update during the observable's operation,
false
otherwiseboolean isDisposable()
Indicates if this listener should be removed from the observable object when a call to
polling(String, java.util.Set)
or nutPolled(NutDao, String, Long)
returns false
.
If a listener is going to be removed, all the other listeners created by the same factory
must be removed if and only if they are also disposable.
true
if this listener is disposable a described, false
otherwiseObject getFactory()
An arbitrary object which helps to know how the listener has been created.
Copyright © 2012-2015. All Rights Reserved.