All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.zipwhip.concurrent.ObservableHelperAdapter Maven / Gradle / Ivy

The newest version!
package com.zipwhip.concurrent;

import com.zipwhip.events.ObservableHelper;
import com.zipwhip.events.Observer;

/**
 * Created with IntelliJ IDEA.
 * User: Michael
 * Date: 9/11/12
 * Time: 2:37 PM
 *
 * Subclass this to adapt the ObservableHelper
 */
public class ObservableHelperAdapter extends ObservableHelper {

    private final ObservableHelper observableHelper;

    public ObservableHelperAdapter(ObservableHelper observableHelper) {
        this.observableHelper = observableHelper;
        this.link(observableHelper);
    }

    @Override
    public void addObserver(Observer observer) {
        observableHelper.addObserver(observer);
    }

    @Override
    public void removeObserver(Observer observer) {
        observableHelper.removeObserver(observer);
    }

    @Override
    public void notifyObservers(Object sender, T result) {
        observableHelper.notifyObservers(sender, result);
    }

    @Override
    public void notifyObserver(Observer observer, Object sender, T result) {
        observableHelper.notifyObserver(observer, sender, result);
    }

    @Override
    public void notify(Object sender, T item) {
        observableHelper.notify(sender, item);
    }

    @Override
    public String toString() {
        return String.format("[a: %s]", observableHelper.toString());
    }

    @Override
    public int hashCode() {
        return observableHelper.hashCode();
    }

    public ObservableHelper getObservableHelper() {
        return observableHelper;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy