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

org.refcodes.eventbus.impls.EventBusObservableImpl Maven / Gradle / Ivy

There is a newer version: 3.3.9
Show newest version
package org.refcodes.eventbus.impls;

import org.refcodes.component.UnknownHandleRuntimeException;
import org.refcodes.eventbus.EventBusObservable;
import org.refcodes.observer.Event;
import org.refcodes.observer.EventMatcher;
import org.refcodes.observer.Observer;

/**
 * This delegate hides any additional functionality away from a caller
 * concerning the the provides implementation.
 *
 * @author steiner
 *
 * @param  The event type
 * @param  The event listener descriptor type
 * @param  The handle type
 */
public class EventBusObservableImpl, O extends Observer, EM extends EventMatcher, H> implements EventBusObservable {

	private EventBusObservable _eventBusObserver;

	/**
	 * Constructs a delegate for a subscribe event bus.
	 * 
	 * @param aSubscribeEventBus The publish event bus to hide away.
	 */
	public EventBusObservableImpl( EventBusObservable aSubscribeEventBus ) {
		_eventBusObserver = aSubscribeEventBus;
	}

	@Override
	public H subscribe( O aObserver, EM aEventMatcher ) {
		return _eventBusObserver.subscribe( aObserver, aEventMatcher );
	}

	@Override
	public void unsubscribeAll( O aEventListener ) {
		_eventBusObserver.unsubscribeAll( aEventListener );

	}

	@Override
	public boolean hasHandle( H aHandle ) {
		return _eventBusObserver.hasHandle( aHandle );
	}

	@Override
	public O lookupHandle( H aHandle ) throws UnknownHandleRuntimeException {
		return _eventBusObserver.lookupHandle( aHandle );
	}

	@Override
	public O removeHandle( H aHandle ) throws UnknownHandleRuntimeException {
		return _eventBusObserver.removeHandle( aHandle );
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy