object Or extends Serializable
The companion object for Or
providing factory methods for creating Or
s from Either
s and Try
s.
- Source
- Or.scala
- Alphabetic
- By Inheritance
- Or
- Serializable
- Serializable
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
from[G, B](option: Option[G], orElse: ⇒ B): Or[G, B]
Constructs a new
Or
from the givenOption
.Constructs a new
Or
from the givenOption
.- option
the
Option
to convert to anOr
- orElse
the
Bad
value to use if theOption
passed asoption
isNone
.- returns
a new
Or
whoseGood
type is theOption
's type and whoseBad
type is the type of the passedorElse
parameter.
-
def
from[B, G](either: Either[B, G]): Or[G, B]
Constructs a new
Or
from the givenEither
.Constructs a new
Or
from the givenEither
.Note that values effectively “switch sides” when converting an
Either
to anOr
. If the type of theEither
which you pass toOr.from
isEither[ErrorMessage, Int]
for example, the result will be anOr[Int, ErrorMessage]
. The reason is that the convention forEither
is thatLeft
is used for “bad” values andRight
is used for “good” ones. If you with to keep the types on the same side, invokeswap
on theEither
before passing it tofrom
.- either
the
Either
to convert to anOr
- returns
a new
Or
whoseGood
type is theEither
'sRight
type and whoseBad
type isEither
'sLeft
type.
-
def
from[G](theTry: Try[G]): Or[G, Throwable]
Constructs a new
Or
from the givenTry
.Constructs a new
Or
from the givenTry
.- theTry
the
Try
to convert to anOr
- returns
a new
Or
whoseGood
type is theTry
'sSuccess
type and whoseBad
type isThrowable
.
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
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()
-
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
- @native() @throws( ... )