sealed trait BoxTrait extends AnyRef
- Alphabetic
- By Inheritance
- BoxTrait
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
def
!![T](in: T): Box[T]
Alias for
legacyNullTest
. -
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
-
def
apply[InType, OutType](value: InType)(pf: PartialFunction[InType, OutType]): Box[OutType]
Apply the specified
PartialFunction
to the specifiedvalue
and return the result in aFull
; if thepf
is not defined at that point return
Empty
.Apply the specified
PartialFunction
to the specifiedvalue
and return the result in aFull
; if thepf
is not defined at that point return
Empty
.- value
The value to transform.
- pf
The partial function to use to transform the value.
- returns
A
Full
containing the transformed value ifpf.isDefinedAt(value)
andEmpty
otherwise.
-
def
apply[InType, OutType](pf: PartialFunction[InType, OutType])(value: InType): Box[OutType]
Apply the specified
PartialFunction
to the specifiedvalue
and return the result in aFull
; if thepf
is not defined at that point return
Empty.
Apply the specified
PartialFunction
to the specifiedvalue
and return the result in aFull
; if thepf
is not defined at that point return
Empty.
- pf
The partial function to use to transform the value.
- value
The value to transform.
- returns
A
Full
containing the transformed value ifpf.isDefinedAt(value)
andEmpty
otherwise.
-
def
apply[T](in: List[T]): Box[T]
Transform a
List
with zero or more elements to aBox
, losing all but the first element if there are more than one.Transform a
List
with zero or more elements to aBox
, losing all but the first element if there are more than one.- returns
Full(x)
with the head of the list if it contains at least one element andEmpty
otherwise.
-
def
apply[T](in: Box[T]): Box[T]
Create a
Box
from the specifiedBox
, checking fornull
.Create a
Box
from the specifiedBox
, checking fornull
.- returns
Full(in)
ifin
is aFull
box and its value is non-null,Empty
otherwise.
-
def
apply[T](in: Option[T]): Box[T]
Create a
Box
from the specifiedOption
.Create a
Box
from the specifiedOption
.- returns
Full
with the contents if theOption
isSome
andEmpty
otherwise.
-
def
asA[B](in: T forSome {type T})(implicit m: Manifest[B]): Box[B]
Create a
Full
box containing the specified value ifin
is of typeB
andEmpty
otherwise.Create a
Full
box containing the specified value ifin
is of typeB
andEmpty
otherwise.For example:
scala> Box.asA[Int]("boom") res0: net.liftweb.common.Box[Int] = Empty scala> Box.asA[Int](5) res1: net.liftweb.common.Box[Int] = Full(5)
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
implicit
def
box2Iterable[T](in: Box[T]): Iterable[T]
This implicit transformation allows one to use a
Box
as anIterable
of zero or one elements.This implicit transformation allows one to use a
Box
as anIterable
of zero or one elements.- returns
A single-element
List
with the contents if the box isFull
andNil
otherwise.
-
implicit
def
box2Option[T](in: Box[T]): Option[T]
This implicit transformation allows one to use a
Box
as anOption
.This implicit transformation allows one to use a
Box
as anOption
.Note that
Box
implementsget
specifically to avoid usage of.get
onBox
instances. Boxes should be opened usingopenOrThrowException
and their contents compared using== Full(expectedValue)
.- returns
Some
with the contents if the box isFull
andNone
otherwise.
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @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] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
-
def
isA[A, B](in: A, clz: Class[B]): Box[B]
Create a
Full
box containing the specified value ifin
is an instance of the specified classclz
andEmpty
otherwise.Create a
Full
box containing the specified value ifin
is an instance of the specified classclz
andEmpty
otherwise.This is basically a Java-friendly version of
asA
, which you should prefer when using Scala.For example:
scala> Box.isA("boom", classOf[Int]) res0: net.liftweb.common.Box[Int] = Empty scala> Box.isA(5, classOf[Int]) res1: net.liftweb.common.Box[Int] = Full(5)
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
legacyNullTest[T](in: T): Box[T]
This method allows one to encapsulate any object in a Box in a null-safe manner, converting
null
values toEmpty
.This method allows one to encapsulate any object in a Box in a null-safe manner, converting
null
values toEmpty
.- returns
Full
ifin
is not null andEmpty
otherwise.
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
implicit
def
option2Box[T](in: Option[T]): Box[T]
This implicit transformation allows one to use an
Option
as aBox
.This implicit transformation allows one to use an
Option
as aBox
.- returns
Full
with the contents if theOption
isSome
andEmpty
otherwise.
- val primitiveMap: Map[Class[_], Class[_]]
-
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( ... )
Deprecated Value Members
-
val
primativeMap: Map[Class[_], Class[_]]
- Annotations
- @deprecated
- Deprecated
(Since version 3.0) Use the correctly-spelled primitiveMap instead.