|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.wamblee.observer.Observable<ObservableType,Event>
public class Observable<ObservableType,Event>
Implements subscription and notification logic for an observer pattern. This class is thread safe.
Constructor Summary | |
---|---|
Observable(ObservableType aObservable,
ObserverNotifier<ObservableType,Event> aNotifier)
Constructs the observable. |
Method Summary | |
---|---|
int |
getObserverCount()
Gets the number of subscribed observers. |
void |
send(Event aEvent)
Notifies all subscribed observers. |
long |
subscribe(Observer<ObservableType,Event> aObserver)
Subscribe an obvers. |
void |
unsubscribe(long aSubscription)
Unsubscribe an observer. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Observable(ObservableType aObservable, ObserverNotifier<ObservableType,Event> aNotifier)
aObservable
- Observable this instance is used for.aNotifier
- Object used for implementing notification of listeners.Method Detail |
---|
public long subscribe(Observer<ObservableType,Event> aObserver)
aObserver
- Observer to subscribe.
public void unsubscribe(long aSubscription)
aSubscription
- Subscription which is used
java.lang.IllegalArgumentException
- In case the subscription is not known.public int getObserverCount()
public void send(Event aEvent)
aEvent
- Event to send.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |