|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
This interface specifies a role for objects that are capable of being observed.
That is to say, objects which play this role are the providers of zero or more
Observer client notifications.
Observer objects are also role-players that hide their basic types
from an Observable. Basically speaking, an Observer
is simply interested in receiving a notification invocation whenever something
happens to change inside an object that implements this interface.
One normally extends this interface because it does not represent a business role. It represents rather a communication or infrastructure role.
The method notifyObservers() informs an Observer that something
has changed inside this Observable.
This class depends on the client Observer interface.
Observer| Method Summary | |
void |
addObserver(Observer observer)
Adds an observer to the internally managed list of observers of this observable. |
void |
clearChanged()
Sets the state to unchanged. |
void |
deleteObserver(Observer observer)
Deletes an observer from the internally managed list of observers of this observable. |
void |
deleteObservers()
Deletes all of the observers registered with this observable. |
java.util.Collection |
getObservers()
Returns a collection of the observers currently registered with this observable. |
void |
notifyObservers()
Performs a notify on all registered observers, if the state has changed since the last notification. |
void |
notifyObservers(java.lang.Object arg)
Performs a notify on all registered observers, if the state has changed since the last notification. |
void |
setChanged()
Sets the state to changed. |
| Method Detail |
public void addObserver(Observer observer)
observer - the observer to add to the internal list.
InvalidArgumentException - if the
observer is currently registered or if the argument is
null.
public void deleteObserver(Observer observer)
throws InvalidArgumentException
observer - the observer to delete from the internal list.
InvalidArgumentException - if the
observer is not currently registered or if the argument is
null.public void deleteObservers()
public void notifyObservers()
setChanged()public void notifyObservers(java.lang.Object arg)
arg - additional argument to pass to the observers.setChanged()public void setChanged()
public void clearChanged()
public java.util.Collection getObservers()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||