From ef1216a8212eab8213ebc1b1721a64080273931b Mon Sep 17 00:00:00 2001 From: Sarah Gerweck Date: Fri, 29 Jul 2016 20:48:09 -0700 Subject: [PATCH] Rename `apply` to `withDefault` --- .../scala/org/gerweck/scalafx/util/FutureObservable.scala | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/scala/org/gerweck/scalafx/util/FutureObservable.scala b/src/main/scala/org/gerweck/scalafx/util/FutureObservable.scala index e572d14..2b119da 100644 --- a/src/main/scala/org/gerweck/scalafx/util/FutureObservable.scala +++ b/src/main/scala/org/gerweck/scalafx/util/FutureObservable.scala @@ -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. *