Package org.osgi.util.promise
Class Promises
- java.lang.Object
 - 
- org.osgi.util.promise.Promises
 
 
- 
public class Promises extends java.lang.ObjectStatic helper methods forPromises.These methods return Promises which use the default callback executor and default scheduled executor. See
PromiseFactoryfor similar methods which use executors other than the default executors.- See Also:
 PromiseFactory
 
- 
- 
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T,S extends T>
Promise<java.util.List<T>>all(java.util.Collection<Promise<S>> promises)Returns a new Promise that is a latch on the resolution of the specified Promises.static <T> Promise<java.util.List<T>>all(Promise<? extends T>... promises)Returns a new Promise that is a latch on the resolution of the specified Promises.static <T> Promise<T>failed(java.lang.Throwable failure)Returns a new Promise that has been resolved with the specified failure.static <T> Promise<T>resolved(T value)Returns a new Promise that has been resolved with the specified value. 
 - 
 
- 
- 
Method Detail
- 
resolved
public static <T> Promise<T> resolved(T value)
Returns a new Promise that has been resolved with the specified value.- Type Parameters:
 T- The value type associated with the returned Promise.- Parameters:
 value- The value of the resolved Promise.- Returns:
 - A new Promise which uses the default callback executor and default scheduled executor that has been resolved with the specified value.
 - See Also:
 PromiseFactory.resolved(Object)
 
- 
failed
public static <T> Promise<T> failed(java.lang.Throwable failure)
Returns a new Promise that has been resolved with the specified failure.- Type Parameters:
 T- The value type associated with the returned Promise.- Parameters:
 failure- The failure of the resolved Promise. Must not benull.- Returns:
 - A new Promise which uses the default callback executor and default scheduled executor that has been resolved with the specified failure.
 - See Also:
 PromiseFactory.failed(Throwable)
 
- 
all
public static <T,S extends T> Promise<java.util.List<T>> all(java.util.Collection<Promise<S>> promises)
Returns a new Promise that is a latch on the resolution of the specified Promises.The returned Promise acts as a gate and must be resolved after all of the specified Promises are resolved.
- Type Parameters:
 T- The value type of the List value associated with the returned Promise.S- A subtype of the value type of the List value associated with the returned Promise.- Parameters:
 promises- The Promises which must be resolved before the returned Promise must be resolved. Must not benulland all of the elements in the collection must not benull.- Returns:
 - A Promise which uses the default callback executor and default
         scheduled executor that is resolved only when all the specified
         Promises are resolved. The returned Promise must be successfully
         resolved with a List of the values in the order of the specified
         Promises if all the specified Promises are successfully resolved.
         The List in the returned Promise is the property of the caller
         and is modifiable. The returned Promise must be resolved with a
         failure of 
FailedPromisesExceptionif any of the specified Promises are resolved with a failure. The failureFailedPromisesExceptionmust contain all of the specified Promises which resolved with a failure. - See Also:
 PromiseFactory.all(Collection)
 
- 
all
@SafeVarargs public static <T> Promise<java.util.List<T>> all(Promise<? extends T>... promises)
Returns a new Promise that is a latch on the resolution of the specified Promises.The new Promise acts as a gate and must be resolved after all of the specified Promises are resolved.
- Type Parameters:
 T- The value type associated with the specified Promises.- Parameters:
 promises- The Promises which must be resolved before the returned Promise must be resolved. Must not benulland all of the arguments must not benull.- Returns:
 - A Promise which uses the default callback executor and scheduled
         executor that is resolved only when all the specified Promises
         are resolved. The returned Promise must be successfully resolved
         with a List of the values in the order of the specified Promises
         if all the specified Promises are successfully resolved. The List
         in the returned Promise is the property of the caller and is
         modifiable. The returned Promise must be resolved with a failure
         of 
FailedPromisesExceptionif any of the specified Promises are resolved with a failure. The failureFailedPromisesExceptionmust contain all of the specified Promises which resolved with a failure. - See Also:
 PromiseFactory.all(Collection)
 
 - 
 
 -