|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectscala.AnyVal
akka.util.Helpers.Requiring<A>
public static final class Helpers.Requiring<A>
Implicit class providing requiring methods. This class is based on
Predef.ensuring in the Scala standard library. The difference is that
this class's methods throw IllegalArgumentExceptions rather than
AssertionErrors.
An example adapted from Predef's documentation:
import akka.util.Helpers.Requiring
def addNaturals(nats: List[Int]): Int = {
require(nats forall (_ >= 0), "List contains negative numbers")
nats.foldLeft(0)(_ + _)
} requiring(_ >= 0)
| Constructor Summary | |
|---|---|
Helpers.Requiring(A value)
|
|
| Method Summary | |
|---|---|
A |
requiring(boolean cond,
scala.Function0<java.lang.Object> msg)
Check that a condition is true. |
A |
requiring(scala.Function1<A,java.lang.Object> cond,
scala.Function0<java.lang.Object> msg)
Check that a condition is true for the value. |
A |
value()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Helpers.Requiring(A value)
| Method Detail |
|---|
public A value()
public A requiring(boolean cond,
scala.Function0<java.lang.Object> msg)
value, otherwise throw
an IllegalArgumentException with the given message.
cond - The condition to check.msg - The message to report if the condition isn't met.
public A requiring(scala.Function1<A,java.lang.Object> cond,
scala.Function0<java.lang.Object> msg)
value. If true, return value,
otherwise throw an IllegalArgumentException with the given message.
cond - The function used to check the value.msg - The message to report if the condition isn't met.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||