Rename apply to withDefault

This commit is contained in:
Sarah Gerweck 2016-07-29 20:48:09 -07:00
parent 8df96ed076
commit ef1216a821

View File

@ -27,7 +27,7 @@ object FutureObservable {
* no equivalent mechanism for this mandatory functionality, but recovery
* is already a built-in feature.
*/
def apply[A](defaultValue: A)(future: Future[A])(implicit ec: ExecutionContext): ReadOnlyObjectProperty[A] = {
def withDefault[A](defaultValue: A)(future: Future[A])(implicit ec: ExecutionContext): ReadOnlyObjectProperty[A] = {
future.value match {
case Some(Success(a)) =>
ObjectProperty(a)
@ -50,6 +50,9 @@ object FutureObservable {
}
}
@deprecated("Use withDefault. `Apply` will be either removed or repurposed in a future release.", "0.10.2")
def apply[A](defaultValue: A)(future: Future[A])(implicit ec: ExecutionContext) = withDefault(defaultValue)(future)
/** Construct an observable that gives `None` until the `Future` completes successfully, after
* which the `Option` contains the successful result.
*