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

org.jdeferred.impl.DeferredPromise Maven / Gradle / Ivy

There is a newer version: 1.2.6
Show newest version
/*******************************************************************************
 * Copyright 2013 Ray Tsang
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 ******************************************************************************/
package org.jdeferred.impl;

import org.jdeferred.AlwaysCallback;
import org.jdeferred.Deferred;
import org.jdeferred.DoneCallback;
import org.jdeferred.DoneFilter;
import org.jdeferred.DonePipe;
import org.jdeferred.FailCallback;
import org.jdeferred.FailFilter;
import org.jdeferred.FailPipe;
import org.jdeferred.ProgressCallback;
import org.jdeferred.ProgressFilter;
import org.jdeferred.ProgressPipe;
import org.jdeferred.Promise;

public class DeferredPromise implements Promise {
	private final Promise promise;
	protected final Deferred deferred;
	
	public DeferredPromise(Deferred deferred) {
		this.deferred = deferred;
		this.promise = deferred.promise();
	}
	
	public org.jdeferred.Promise.State state() {
		return promise.state();
	}

	public boolean isPending() {
		return promise.isPending();
	}

	public boolean isResolved() {
		return promise.isResolved();
	}

	public boolean isRejected() {
		return promise.isRejected();
	}

	public Promise then(DoneCallback doneCallback) {
		return promise.then(doneCallback);
	}

	public Promise then(DoneCallback doneCallback,
			FailCallback failCallback) {
		return promise.then(doneCallback, failCallback);
	}

	public Promise then(DoneCallback doneCallback,
			FailCallback failCallback, ProgressCallback

progressCallback) { return promise.then(doneCallback, failCallback, progressCallback); } public Promise then( DoneFilter doneFilter) { return promise.then(doneFilter); } public Promise then( DoneFilter doneFilter, FailFilter failFilter) { return promise.then(doneFilter, failFilter); } public Promise then( DoneFilter doneFilter, FailFilter failFilter, ProgressFilter progressFilter) { return promise.then(doneFilter, failFilter, progressFilter); } public Promise done(DoneCallback callback) { return promise.done(callback); } public Promise fail(FailCallback callback) { return promise.fail(callback); } public Promise always(AlwaysCallback callback) { return promise.always(callback); } public Promise progress(ProgressCallback

callback) { return promise.progress(callback); } @Override public void waitSafely() throws InterruptedException { promise.waitSafely(); } @Override public void waitSafely(long timeout) throws InterruptedException { promise.waitSafely(timeout); } @Override public Promise then( DonePipe doneFilter) { return promise.then(doneFilter); } @Override public Promise then( DonePipe doneFilter, FailPipe failFilter) { return promise.then(doneFilter, failFilter); } @Override public Promise then( DonePipe doneFilter, FailPipe failFilter, ProgressPipe progressFilter) { return promise.then(doneFilter, failFilter, progressFilter); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy