Helper class to provide an easy way for converting a List[Box[T]] into
a Box[List[T]].
Alias for legacyNullTest.
Alias for legacyNullTest.
Apply the specified PartialFunction to the specified value and return
the result in a Full; if the pf is not defined at that point return
Empty.
Apply the specified PartialFunction to the specified value and return
the result in a Full; if the pf is not defined at that point return
Empty.
The value to transform.
The partial function to use to transform the value.
A Full containing the transformed value if
pf.isDefinedAt(value) and Empty otherwise.
Apply the specified PartialFunction to the specified value and return the result
in a Full; if the pf is not defined at that point return Empty.
Apply the specified PartialFunction to the specified value and return the result
in a Full; if the pf is not defined at that point return Empty.
The partial function to use to transform the value.
The value to transform.
A Full containing the transformed value if
pf.isDefinedAt(value) and Empty otherwise.
Transform a List with zero or more elements to a Box, losing all but
the first element if there are more than one.
Transform a List with zero or more elements to a Box, losing all but
the first element if there are more than one.
Full(x) with the head of the list if it contains at least one
element and Empty otherwise.
Create a Box from the specified Box, checking for null.
Create a Box from the specified Box, checking for null.
Full(in) if in is a Full box and its value is non-null,
Empty otherwise.
Create a Box from the specified Option.
Create a Box from the specified Option.
Full with the contents if the Option is Some
and Empty otherwise.
Create a Full box containing the specified value if in is of type
B and Empty otherwise.
Create a Full box containing the specified value if in is of type
B and Empty 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)
This implicit transformation allows one to use a Box as an Iterable of
zero or one elements.
This implicit transformation allows one to use a Box as an Option.
This implicit transformation allows one to use a Box as an Option.
Note that Box implements get specifically to avoid usage of .get on
Box instances. Boxes should be opened using openOrThrowException and
their contents compared using == Full(expectedValue).
Some with the contents if the box is Full and None
otherwise.
Create a Full box containing the specified value if in is an instance of
the specified class clz and Empty otherwise.
Create a Full box containing the specified value if in is an instance of
the specified class clz and Empty 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)
This method allows one to encapsulate any object in a Box in a null-safe
manner, converting null values to Empty.
This method allows one to encapsulate any object in a Box in a null-safe
manner, converting null values to Empty.
Full if in is not null and Empty otherwise.
This implicit transformation allows one to use an Option as a Box.
This implicit transformation allows one to use an Option as a Box.
Full with the contents if the Option is Some and Empty
otherwise.
Wraps a "try" block around the function f.
Wraps a "try" block around the function f. Takes only one Class of exception to ignore
- a single exception classes to ignore. A thrown exception will be ignored if it is assignable from this class.
- the block of code to evaluate
Wraps a "try" block around the function f
Wraps a "try" block around the function f
- a list of exception classes to ignore. A thrown exception will be ignored if it is assignable from one of the exception classes in the list
- the block of code to evaluate
Wraps a "try" block around the function f and trigger a callback function if an exception is thrown
Wraps a "try" block around the function f and trigger a callback function if an exception is thrown
- an optional callback function that will use the thrown exception as a parameter
- the block of code to evaluate
Wraps a "try" block around the function f
Wraps a "try" block around the function f
- the block of code to evaluate
Wraps a "try" block around the function f.
Wraps a "try" block around the function f. If f throws an exception that is in the domain of the handler PF, the handler will be invoked on the exception. Otherwise the exception is wrapped into a Failure.
- A partial function that handles exceptions
- the block of code to evaluate
net.liftweb.common.Failure
Wraps a "try" block around the function f.
Wraps a "try" block around the function f. If f throws an exception with its class in the 'ignore' list or if 'ignore' is null or an empty list, ignore the exception and return None.
- a list of exception classes to ignore. A thrown exception will be ignored if it is assignable from one of the exception classes in the list
- an optional callback function that will use the thrown exception as a parameter
- the block of code to evaluate
(Since version 3.0) Use the correctly-spelled primitiveMap instead.
The Box companion object provides methods to create a Box from:
OptionListAnyRefobject, convertingnulltoEmptyand anything else to aFullwith the given objectIt also provides implicit methods to transform
OptiontoBox,BoxtoIterable, andBoxtoOption.