net.liftweb.common

EmptyBox

sealed abstract class EmptyBox extends Box[Nothing] with Serializable

The EmptyBox is a Box containing no value.

Linear Supertypes
Box[Nothing], Serializable, Serializable, Product, Equals, AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. EmptyBox
  2. Box
  3. Serializable
  4. Serializable
  5. Product
  6. Equals
  7. AnyRef
  8. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new EmptyBox()

Type Members

  1. class WithFilter extends AnyRef

    Play NiceLike with the Scala 2.

Abstract Value Members

  1. abstract def canEqual(that: Any): Boolean

    Definition Classes
    Equals
  2. abstract def productArity: Int

    Definition Classes
    Product
  3. abstract def productElement(n: Int): Any

    Definition Classes
    Product

Concrete Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. def $(f: (Box[Nothing]) ⇒ Unit): Box[Nothing]

    Alias for pass

    Alias for pass

    Definition Classes
    Box
  5. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  6. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  7. def ===[B >: Nothing](to: B): Boolean

    Returns true if the value contained in this box is equal to the specified value.

    Returns true if the value contained in this box is equal to the specified value.

    Definition Classes
    Box
  8. def ?~(msg: ⇒ String): Failure

    Transform an Empty to a Failure with the specified message.

    Transform an Empty to a Failure with the specified message.

    msg

    the failure message

    returns

    a Failure with the message if this Box is Empty

    Definition Classes
    EmptyBoxBox
  9. def ?~!(msg: ⇒ String): Failure

    Transform an EmptyBox to a Failure with the specified message and chain the new Failure to any previous Failure represented by this Box.

    Transform an EmptyBox to a Failure with the specified message and chain the new Failure to any previous Failure represented by this Box.

    msg

    the failure message

    returns

    a Failure with the message if this Box is an Empty Box. Chain the messages if it is already a Failure

    Definition Classes
    EmptyBoxBox
  10. def asA[B](implicit m: Manifest[B]): Box[B]

    Return a Full[B] if the contents of this Box is of type B, otherwise return Empty

    Return a Full[B] if the contents of this Box is of type B, otherwise return Empty

    Definition Classes
    Box
  11. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  12. def choice[B](f1: (Nothing) ⇒ Box[B])(alternative: ⇒ Box[B]): Box[B]

    Apply the function f1 to the contents of this Box if available; if this is empty return the specified alternative.

    Apply the function f1 to the contents of this Box if available; if this is empty return the specified alternative.

    Definition Classes
    Box
  13. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  14. final def collect[B](pf: PartialFunction[Nothing, B]): Box[B]

    If the partial function is defined at the current Box's value apply the partial function.

    If the partial function is defined at the current Box's value apply the partial function.

    Definition Classes
    Box
  15. def compoundFailMsg(msg: ⇒ String): Box[Nothing]

    Alias for ?~!

    Alias for ?~!

    Definition Classes
    Box
  16. def dmap[B](dflt: ⇒ B)(f: (Nothing) ⇒ B): B

    Equivalent to map(f).

    Equivalent to map(f).openOr(Full(dflt))

    Definition Classes
    Box
  17. def elements: Iterator[Nothing]

    Returns an Iterator over the value contained in this Box

    Returns an Iterator over the value contained in this Box

    Definition Classes
    Box
  18. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  19. def equals(other: Any): Boolean

    Determines equality based upon the contents of this Box instead of the box itself.

    Determines equality based upon the contents of this Box instead of the box itself. As a result, it is not symmetric. Which means that for

        val foo = "foo"
        val boxedFoo = Full(foo)
        foo == boxedFoo //is false
        boxedFoo == foo //is true
    

    For Full and Empty, this has the expected behavior. Equality in terms of Failure checks for equivalence of failure causes.

    Definition Classes
    Box → Equals → AnyRef → Any
  20. def exists(func: (Nothing) ⇒ Boolean): Boolean

    Determine whether this Box contains a value which satisfies the specified predicate

    Determine whether this Box contains a value which satisfies the specified predicate

    returns

    true if this Box does contain a value and it satisfies the predicate

    Definition Classes
    Box
  21. def failMsg(msg: ⇒ String): Box[Nothing]

    Alias for ?~

    Alias for ?~

    Definition Classes
    Box
  22. def filter(p: (Nothing) ⇒ Boolean): Box[Nothing]

    Return this Box if it contains a value satisfying the specified predicate; Empty otherwise

    Return this Box if it contains a value satisfying the specified predicate; Empty otherwise

    returns

    this Box if it contains a value satisfying the specified predicate; Empty otherwise

    Definition Classes
    EmptyBoxBox
  23. def filterMsg(msg: String)(p: (Nothing) ⇒ Boolean): Box[Nothing]

    Filter this box on the specified predicate, returning a Failure with the specified message if the predicate is not satisfied.

    Filter this box on the specified predicate, returning a Failure with the specified message if the predicate is not satisfied.

    msg

    the failure message

    p

    a predicate

    returns

    a Failure with the message if the predicate is not satisfied by the value contained in this Box

    Definition Classes
    Box
  24. def filterNot(f: (Nothing) ⇒ Boolean): Box[Nothing]

    Creates a Box if the current Box is Full and the value does not satisfy the predicate, f.

    Creates a Box if the current Box is Full and the value does not satisfy the predicate, f.

    f

    the predicate used to test value.

    returns

    a Box

    Definition Classes
    Box
  25. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  26. def flatMap[B](f: (Nothing) ⇒ Box[B]): Box[B]

    Apply a function returning a Box to the value contained in this Box if it exists and return the result, or empty otherwise.

    Apply a function returning a Box to the value contained in this Box if it exists and return the result, or empty otherwise.

    returns

    the modified Box or empty

    Definition Classes
    Box
  27. def forall(func: (Nothing) ⇒ Boolean): Boolean

    Determine whether all Box values satisfy the predicate

    Determine whether all Box values satisfy the predicate

    returns

    true if the Box is empty, or if Box's value satisfies the predicate

    Definition Classes
    Box
  28. def foreach[U](f: (Nothing) ⇒ U): Unit

    Perform a side effect by calling the specified function with the value contained in this box.

    Perform a side effect by calling the specified function with the value contained in this box.

    Definition Classes
    Box
  29. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  30. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  31. def isA[B](cls: Class[B]): Box[B]

    Return a Full[B] if the contents of this Box is an instance of the specified class, otherwise return Empty

    Return a Full[B] if the contents of this Box is an instance of the specified class, otherwise return Empty

    Definition Classes
    Box
  32. def isDefined: Boolean

    Returns true if the box contains a value.

    Returns true if the box contains a value.

    returns

    true if this Box contains a value

    Definition Classes
    Box
  33. def isEmpty: Boolean

    Returns true if this Box contains no value (is Empty or Failure or ParamFailure)

    Returns true if this Box contains no value (is Empty or Failure or ParamFailure)

    returns

    true if this Box contains no value

    Definition Classes
    EmptyBoxBox
  34. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  35. def iterator: Iterator[Nothing]

    Returns an Iterator over the value contained in this Box

    Returns an Iterator over the value contained in this Box

    Definition Classes
    Box
  36. def javaIterator[B >: Nothing]: Iterator[B]

    Get a Java Iterator from the Box

    Get a Java Iterator from the Box

    Definition Classes
    Box
  37. def map[B](f: (Nothing) ⇒ B): Box[B]

    Apply a function to the value contained in this Box if it exists and return a new Box containing the result, or empty otherwise.

    Apply a function to the value contained in this Box if it exists and return a new Box containing the result, or empty otherwise.

    returns

    the modified Box or empty

    Definition Classes
    Box
  38. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  39. final def notify(): Unit

    Definition Classes
    AnyRef
  40. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  41. def openOr[B](default: ⇒ B): B

    Return the value contained in this Box if it is full; otherwise return the specified default

    Return the value contained in this Box if it is full; otherwise return the specified default

    returns

    the value contained in this Box if it is full; otherwise return the specified default

    Definition Classes
    EmptyBoxBox
  42. def openOrThrowException(justification: String): Nothing

    If you grew up on Java, you're used to Exceptions as part of your program logic.

    If you grew up on Java, you're used to Exceptions as part of your program logic. The Scala philosophy and the Lift philosophy is that exceptions are for exceptional conditions such as failure of an external resource (e.g., your database goes offline) rather than simply indicating that a parameter wasn't supplied or couldn't be parsed.

    Lift's Box and Scala's Option provide a mechanism for being explicit about a value existing or not existing rather than relying on a reference being not-null. However, extracting a value from a Box should be done correctly. Correctly can be (in order of use in David Pollak's code): a for comprehension; using map, flatMap or foreach; or using pattern matching.

    The only times when you should be using this method are: the value is guaranteed to be available based on a guard outside of the method using the Box or in tests. For example, User.currentUser.openOrThrowException("This snippet is used on pages where the user is logged in")

    A valid justification for using this method should not be "I want my code to fail fast when I call it." Using exceptions in the core logic of your application should be strongly discouraged.

    This method replaces open_! because people used open_! and generally ignored the reason for the "!", so we're making it more explicit that this method should not commonly be used and should be justified when used.

    justification

    Justify why calling this method is okay and why it will not result in an Exception

    returns

    The contents of the Box if it has one or an exception if not

    Definition Classes
    EmptyBoxBox
  43. def or[B](alternative: ⇒ Box[B]): Box[B]

    Return this Box if Full, or the specified alternative if this is empty

    Return this Box if Full, or the specified alternative if this is empty

    Definition Classes
    EmptyBoxBox
  44. def pass(f: (Box[Nothing]) ⇒ Unit): Box[Nothing]

    Perform a side effect by passing this Box to the specified function and return this Box unmodified.

    Perform a side effect by passing this Box to the specified function and return this Box unmodified.

    returns

    this Box

    Definition Classes
    Box
  45. def productIterator: Iterator[Any]

    Definition Classes
    Product
  46. def productPrefix: String

    Definition Classes
    Product
  47. def run[T](in: ⇒ T)(f: (T, Nothing) ⇒ T): T

    This method calls the specified function with the value contained in this Box

    This method calls the specified function with the value contained in this Box

    returns

    the result of the function or a default value

    Definition Classes
    Box
  48. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  49. def toLeft[B](right: ⇒ B): Either[Nothing, B]

    An Either that is a Right with the given argument right if this is empty, or a Left if this is Fill with the Box's value

    An Either that is a Right with the given argument right if this is empty, or a Left if this is Fill with the Box's value

    Definition Classes
    Box
  50. def toList: List[Nothing]

    Returns a List of one element if this is Full, or an empty list if empty.

    Returns a List of one element if this is Full, or an empty list if empty.

    Definition Classes
    Box
  51. def toOption: Option[Nothing]

    Returns the contents of this box in an Option if this is Full, or None if this is a empty (Empty, Failure or ParamFailure)

    Returns the contents of this box in an Option if this is Full, or None if this is a empty (Empty, Failure or ParamFailure)

    Definition Classes
    Box
  52. def toRight[B](left: ⇒ B): Either[B, Nothing]

    An Either that is a Left with the given argument left if this is empty, or a Right if this Full with the Box's value.

    An Either that is a Left with the given argument left if this is empty, or a Right if this Full with the Box's value.

    Definition Classes
    Box
  53. def toString(): String

    Definition Classes
    AnyRef → Any
  54. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  55. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  56. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  57. def withFilter(p: (Nothing) ⇒ Boolean): WithFilter

    Makes Box play better with Scala 2.

    Makes Box play better with Scala 2.8 for comprehensions

    Definition Classes
    Box
  58. def ~>[T](errorCode: ⇒ T): ParamFailure[T]

    Transform an Empty to a ParamFailure with the specified typesafe parameter.

    Transform an Empty to a ParamFailure with the specified typesafe parameter.

    errorCode

    a value indicating the error

    returns

    a ParamFailure with the specified value

    Definition Classes
    EmptyBoxBox

Deprecated Value Members

  1. final def get: Nothing

    Return the value contained in this Box if it is Full; throw an exception otherwise.

    Return the value contained in this Box if it is Full; throw an exception otherwise. Please use openOrThrowException instead. In the past, this method triggered an implicit conversion to Option and could throw an unintended NullPointerException. That is no longer the case, and in Lift 3 this method will be changed to return a useless type so that the compiler will break attempts to use it.

    Definition Classes
    Box
    Annotations
    @deprecated
    Deprecated

    (Since version 2.6) use map/flatMap/foreach if possible, or openOrThrowException if you must

  2. final def openTheBox: Nothing

    Return the value contained in this Box if it is Full; throw an exception otherwise.

    Return the value contained in this Box if it is Full; throw an exception otherwise. This means "don't use it unless you are 100% sure that the Box is Full and you should probably comment your code with the explanation of the guaranty. The better case for extracting the value out of a Box can be found at http://lift.la/scala-option-lift-box-and-how-to-make-your-co

    returns

    the value contained in this Box if it is full; throw an exception otherwise

    Definition Classes
    Box
    Annotations
    @deprecated
    Deprecated

    (Since version 2.4) use openOrThrowException, or better yet, do the right thing with your code and use map, flatMap or foreach

  3. final def open_!: Nothing

    Return the value contained in this Box if it is Full; throw an exception otherwise.

    Return the value contained in this Box if it is Full; throw an exception otherwise.

    Using open_! in an example posted to the Lift mailing list may disqualify you for a helpful response.

    The method has a '!' in its name. This means "don't use it unless you are 100% sure that the Box is Full and you should probably comment your code with the explanation of the guaranty." The better case for extracting the value out of a Box can be found at http://lift.la/scala-option-lift-box-and-how-to-make-your-co

    returns

    the value contained in this Box if it is full; throw an exception otherwise

    Definition Classes
    Box
    Annotations
    @deprecated
    Deprecated

    (Since version 2.4) use openOrThrowException, or better yet, do the right thing with your code and use map, flatMap or foreach

Inherited from Box[Nothing]

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Ungrouped