Observable<T> Class

  • java.lang.Object
    • system.fabric.Observable<T>

Type Parameters

T

Takes a template parameter T.

public class Observable

This class represents an observable object

Constructor Summary

Constructor Description
Observable()

Instantiates an system.fabric.Observable object.

Method Summary

Modifier and Type Method and Description
void addObserver(Observer<? super T> observer)

Adds an observer to the set of observers for this object.

void clearObservers()

Removes all the observers of this class.

int countObservers()

Number of observers of this object.

List<Observer<? super T>> getAllObservers()

Lists all the observers of this object.

void notifyObservers(final Object sender)

Notify all of its observers

void notifyObservers(final Object sender, final T value)

Notify all of its observers

void removeObserver(Observer<? super T> observable)

Removes an observer from the set of observers of this object.

Constructor Details

Observable

public Observable()

Instantiates an system.fabric.Observable object.

Method Details

addObserver

public void addObserver(Observer observer)

Adds an observer to the set of observers for this object.

Parameters:

observer - Takes an Observer<U> object as parameter.

clearObservers

public void clearObservers()

Removes all the observers of this class.

countObservers

public int countObservers()

Number of observers of this object.

Returns:

Returns integer count of all the observers.

getAllObservers

public List> getAllObservers()

Lists all the observers of this object.

Returns:

A java.util.List of Observer<U>

notifyObservers

public void notifyObservers(final Object sender)

Notify all of its observers

Parameters:

sender - sender object.

notifyObservers

public void notifyObservers(final Object sender, final T value)

Notify all of its observers

Parameters:

sender - sender object.
value - value to notify with.

removeObserver

public void removeObserver(Observer observable)

Removes an observer from the set of observers of this object.

Parameters:

observable -

Observer<U> object as parameter.

Applies to