class Response[T] extends AnyRef
Typical interaction, given a predicate <user-input>, a function <display>, and an exception handler <handle>:
val TIMEOUT = 100 // (milliseconds) or something like that val r = new Response() while (!r.isComplete && !r.isCancelled) { if (<user-input>) r.cancel() else r.get(TIMEOUT) match { case Some(Left(data)) => <display>(data) case Some(Right(exc)) => <handle>(exc) case None => } }
- Source
- Response.scala
- Alphabetic
- By Inheritance
- Response
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- All
Instance Constructors
- new Response()
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
- def +(other: String): String
- def ->[B](y: B): (Response[T], B)
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
cancel(): Unit
Cancel action computing this response (Only the party that calls get on a response may cancel).
- def clear(): Unit
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
- def ensuring(cond: (Response[T]) ⇒ Boolean, msg: ⇒ Any): Response[T]
- def ensuring(cond: (Response[T]) ⇒ Boolean): Response[T]
- def ensuring(cond: Boolean, msg: ⇒ Any): Response[T]
- def ensuring(cond: Boolean): Response[T]
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
get(timeout: Long): Option[Either[T, Throwable]]
Optionally get data within
timeout
milliseconds.Optionally get data within
timeout
milliseconds. When interrupted will return with Some(Right(InterruptedException)) When timeout ends, will return last stored provisional result, or else None if no provisional result was stored. -
def
get: Either[T, Throwable]
Get final data, wait as long as necessary.
Get final data, wait as long as necessary. When interrupted will return with Right(InterruptedException)
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
isCancelled: Boolean
A cancel request for this response has been issued
-
def
isComplete: Boolean
Final data set was stored
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
def
raise(exc: Throwable): Unit
Store raised exception in data, and mark response as complete.
-
def
set(x: T): Unit
Set final data, and mark response as complete.
-
def
setProvisionally(x: T): Unit
Set provisional data, more to come
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
- def →[B](y: B): (Response[T], B)
Deprecated Value Members
-
def
formatted(fmtstr: String): String
- Implicit
- This member is added by an implicit conversion from Response[T] to StringFormat[Response[T]] performed by method StringFormat in scala.Predef.
- Definition Classes
- StringFormat
- Annotations
- @deprecated @inline()
- Deprecated
(Since version 2.12.16) Use
formatString.format(value)
instead ofvalue.formatted(formatString)
, or use thef""
string interpolator. In Java 15 and later,formatted
resolves to the new method in String which has reversed parameters.
The Scala compiler and reflection APIs.