T
- Data type transported in updatespublic class Subject<T> extends java.lang.Object implements IPublishSubscribe<T>
Constructor and Description |
---|
Subject()
Default constructor creating the observer list
|
Modifier and Type | Method and Description |
---|---|
void |
attach(IObserver<T> observer)
Add an observer to the list of observers
|
boolean |
detach(IObserver<T> observer)
Removes an observer from the list of observers
|
void |
detachAll()
Removes all observers from the list of observers
|
void |
onStateChange(T content)
Called to inform observer about a change in state
|
public void attach(IObserver<T> observer)
IPublishSubscribe
attach
in interface IPublishSubscribe<T>
observer
- The observer that wants to be addedpublic boolean detach(IObserver<T> observer)
IPublishSubscribe
detach
in interface IPublishSubscribe<T>
observer
- The observer that wants to be removedpublic void detachAll()
IPublishSubscribe
detachAll
in interface IPublishSubscribe<T>
public void onStateChange(T content)
IPublishSubscribe
onStateChange
in interface IPublishSubscribe<T>
content
- the object that contains the changed information