Class/Object

ars.precondition.require

Require

Related Docs: object Require | package require

Permalink

class Require extends RequireCore with RequireAll with RequireAllSpecific with RequireAny with RequireIterable with RequireNumeric with RequireNumericRange with RequireOptional with RequireSize with RequireString with RequireStringFormat with RequireStringNumeric

Default implementation containing all requireXXX methods.

Since

0.0.4

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Require
  2. RequireStringNumeric
  3. RequireStringFormat
  4. RequireSize
  5. RequireOptional
  6. RequireNumericRange
  7. RequireNumeric
  8. RequireIterable
  9. RequireAllSpecific
  10. RequireString
  11. RequireAny
  12. RequireAll
  13. RequireCore
  14. AnyRef
  15. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Require()

    Permalink

Value Members

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

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  7. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  8. def exception(message: String, cause: Option[RuntimeException] = None): RuntimeException

    Permalink

    Creates a new instance of exception.

    Creates a new instance of exception. Default implementation uses RequireCore.DefaultExceptionCreator exception creator.

    message

    the message (must be non-blank)

    cause

    the cause exception (must be non-null and not Some(null))

    returns

    new exception instance (non-null)

    Definition Classes
    RequireCore
    Exceptions thrown

    RuntimeException if any argument is not valid

  9. def fail(message: ⇒ Any, throwable: Option[RuntimeException] = None): Unit

    Permalink

    Fails test.

    Fails test. Must be invoked at every time when requireXXX method fails. Default implementation invokes exception() to create new exception instance with message produced by failureMessage() method and throws the result.

    message

    the String to include in the failure message (must be non-null)

    Definition Classes
    RequireCore
    Exceptions thrown

    RuntimeException at every invokation

  10. def failureMessage[T](message: ⇒ T): String

    Permalink

    Constructs the failure message.

    Constructs the failure message. Default implementation invokes toString() method of message and returns result.

    message

    the source message (must be non-null)

    returns

    the failure message (non-null)

    Definition Classes
    RequireCore
    Exceptions thrown

    RuntimeException if message is null

  11. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  12. final def getClass(): Class[_]

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

    Permalink
    Definition Classes
    AnyRef → Any
  14. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  15. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  16. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  17. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  18. def optional[T](value: Option[T], name: String = NoNameParameter)(require: RequireFunction[T]): Unit

    Permalink

    Invokes require function if value is Some(_) and do nothing otherwise.

    Invokes require function if value is Some(_) and do nothing otherwise.

    T

    the type of value

    value

    the value (must be non-null)

    require

    the function (must be non-null)

    Definition Classes
    RequireOptional
    Annotations
    @inline()
  19. def optionalPredicate[T](value: Option[T], name: String = NoNameParameter)(predicate: RequirePredicate[T]): Unit

    Permalink
    Definition Classes
    RequireOptional
    Annotations
    @inline()
  20. implicit def pred2elem[T](predicate: RequirePredicate[T]): RequireElementFunction[T]

    Permalink

    Wraps predicate RequirePredicate to element function RequireElementFunction.

    Wraps predicate RequirePredicate to element function RequireElementFunction.

    T

    the type of element

    predicate

    the predicate (must be non-null)

    returns

    the new RequireElementFunction instance

    Definition Classes
    RequireCore
  21. implicit def pred2func[T](predicate: RequirePredicate[T]): RequireFunction[T]

    Permalink

    Wraps predicate RequirePredicate to element function RequireFunction.

    Wraps predicate RequirePredicate to element function RequireFunction.

    T

    the type of element

    predicate

    the predicate (must be non-null)

    returns

    the new RequireFunction instance

    Definition Classes
    RequireCore
  22. def require[T](requirement: ⇒ Boolean, message: ⇒ T): Unit

    Permalink

    Invokes requirement to test an expression and calls fail if it returns false.

    Invokes requirement to test an expression and calls fail if it returns false.

    requirement

    the expression to test

    message

    a String to include in the failure message (must be non-null)

    Definition Classes
    RequireCore
    Exceptions thrown

    RuntimeException if requirement invokation returns false of any argument is not valid

  23. def requireAll[T](value: Iterable[T], name: String = NoNameParameter)(require: RequireElementFunction[T]): Unit

    Permalink

    Calls require for all elements of iterable value.

    Calls require for all elements of iterable value. The require must test the element and throws RequireCore.exception() if it's not satisfy the requirements.

    T

    the type of iterable elements

    value

    the iterable value (must be non-null)

    name

    the name to include in the failure message (must be non-null)

    require

    the test function (must be non-null)

    Definition Classes
    RequireAll
    Exceptions thrown

    RuntimeException if test fails

  24. def requireAllNotBlank(value: Iterable[String], name: String = NoNameParameter): Unit

    Permalink

    Tests that iterable value does not contain blank (null or empty) strings, and otherwise throws RequireCore.exception().

    Tests that iterable value does not contain blank (null or empty) strings, and otherwise throws RequireCore.exception().

    value

    the iterable value (must be non-null)

    name

    the name to include in the failure message (must be non-null)

    Definition Classes
    RequireAllSpecific
    Annotations
    @inline()
  25. def requireAllNotNull[T](value: Iterable[T], name: String = NoNameParameter): Unit

    Permalink

    Tests that iterable value does not contain null values, and otherwise throws RequireCore.exception().

    Tests that iterable value does not contain null values, and otherwise throws RequireCore.exception().

    T

    the type of iterable elements

    value

    the iterable value (must be non-null)

    name

    the name to include in the failure message (must be non-null)

    Definition Classes
    RequireAllSpecific
    Annotations
    @inline()
  26. def requireAllPredicate[T](value: Iterable[T], name: String = NoNameParameter)(predicate: RequirePredicate[T]): Unit

    Permalink

    Calls predicate for all elements of iterable value.

    Calls predicate for all elements of iterable value. It throws RequireCore.exception() if there's an element that does not satisfy the requirements.

    T

    the type of iterable elements

    value

    the iterable value (must be non-null)

    name

    the name to include in the failure message (must be non-null)

    predicate

    the predicate (must be non-null)

    Definition Classes
    RequireAll
    Exceptions thrown

    RuntimeException if test fails

  27. def requireByte(value: String, name: String = NoNameParameter): Unit

    Permalink

    Tests that value is a Byte number string, and otherwise throws IllegalArgumentException.

    Tests that value is a Byte number string, and otherwise throws IllegalArgumentException.

    value

    the value to test

    name

    the name to include in the failure message

    Definition Classes
    RequireStringNumeric
  28. def requireDouble(value: String, name: String = NoNameParameter): Unit

    Permalink

    Tests that value is a Double number string, and otherwise throws IllegalArgumentException.

    Tests that value is a Double number string, and otherwise throws IllegalArgumentException.

    value

    the value to test

    name

    the name to include in the failure message

    Definition Classes
    RequireStringNumeric
  29. def requireEmail(email: String, name: String = NoNameParameter): Unit

    Permalink

    Tests that string email is a correct email address, and otherwise throws RequireCore.exception().

    Tests that string email is a correct email address, and otherwise throws RequireCore.exception().

    email

    the testing email string (must be non-null)

    name

    the name to include in the failure message (must be non-null)

    Definition Classes
    RequireStringFormat
    Annotations
    @inline()
    Exceptions thrown

    RuntimeException if test fails

  30. def requireFloat(value: String, name: String = NoNameParameter): Unit

    Permalink

    Tests that value is a Float number string, and otherwise throws IllegalArgumentException.

    Tests that value is a Float number string, and otherwise throws IllegalArgumentException.

    value

    the value to test

    name

    the name to include in the failure message

    Definition Classes
    RequireStringNumeric
  31. def requireInt(value: String, name: String = NoNameParameter): Unit

    Permalink

    Tests that value is an Int number string, and otherwise throws IllegalArgumentException.

    Tests that value is an Int number string, and otherwise throws IllegalArgumentException.

    value

    the value to test

    name

    the name to include in the failure message

    Definition Classes
    RequireStringNumeric
  32. def requireLong(value: String, name: String = NoNameParameter): Unit

    Permalink

    Tests that value is a Long number string, and otherwise throws IllegalArgumentException.

    Tests that value is a Long number string, and otherwise throws IllegalArgumentException.

    value

    the value to test

    name

    the name to include in the failure message

    Definition Classes
    RequireStringNumeric
  33. def requireNegative[T](value: T, name: String = NoNameParameter)(implicit arg0: Numeric[T]): Unit

    Permalink

    Tests that value is negative, and otherwise throws RequireCore.exception().

    Tests that value is negative, and otherwise throws RequireCore.exception().

    value

    the value to test (must be non-null)

    name

    the name to include in the failure message (must be non-null)

    Definition Classes
    RequireNumeric
    Exceptions thrown

    RuntimeException if test fails

  34. def requireNonNegative[T](value: T, name: String = NoNameParameter)(implicit arg0: Numeric[T]): Unit

    Permalink

    Tests that value is positive or zero, and otherwise throws RequireCore.exception().

    Tests that value is positive or zero, and otherwise throws RequireCore.exception().

    value

    the value to test (must be non-null)

    name

    the name to include in the failure message (must be non-null)

    Definition Classes
    RequireNumeric
    Exceptions thrown

    RuntimeException if test fails

  35. def requireNonPositive[T](value: T, name: String = NoNameParameter)(implicit arg0: Numeric[T]): Unit

    Permalink

    Tests that value is negative or zero, and otherwise throws RequireCore.exception().

    Tests that value is negative or zero, and otherwise throws RequireCore.exception().

    value

    the value to test (must be non-null)

    name

    the name to include in the failure message (must be non-null)

    Definition Classes
    RequireNumeric
    Exceptions thrown

    RuntimeException if test fails

  36. def requireNotBlank[T](value: Iterable[T]): Unit

    Permalink

    Tests that sequence value isn't null or empty, and otherwise throws RequireCore.exception().

    Tests that sequence value isn't null or empty, and otherwise throws RequireCore.exception().

    T

    the type of iterable elements

    value

    the iterable to test

    Definition Classes
    RequireIterable
    Exceptions thrown

    RuntimeException if test fails

  37. def requireNotBlank[T](value: Iterable[T], name: String): Unit

    Permalink

    Tests that sequence value isn't null or empty, and otherwise throws RequireCore.exception().

    Tests that sequence value isn't null or empty, and otherwise throws RequireCore.exception().

    T

    the type of iterable elements

    value

    the iterable to test

    name

    the name to include in the failure message

    Definition Classes
    RequireIterable
    Exceptions thrown

    RuntimeException if test fails

  38. def requireNotBlank(value: String, name: String = NoNameParameter): Unit

    Permalink

    Tests that value isn't null or empty (after trim), and otherwise throws RequireCore.exception().

    Tests that value isn't null or empty (after trim), and otherwise throws RequireCore.exception().

    value

    the value to test (must be non-null)

    name

    the name to include in the failure message (must be non-null)

    Definition Classes
    RequireString
    Exceptions thrown

    RuntimeException if test fails

  39. def requireNotNull(value: Any, name: String = NoNameParameter): Unit

    Permalink

    Tests that value isn't null, and otherwise throws RequireCore.exception().

    Tests that value isn't null, and otherwise throws RequireCore.exception().

    value

    the value to test

    name

    the name to include in the failure message (must be non-null)

    Definition Classes
    RequireAny
  40. def requireNumber[T](value: T, number: T, name: String = NoNameParameter)(implicit arg0: Numeric[T]): Unit

    Permalink

    Test that value is equal to number, and otherwise throws RequireCore.exception().

    Test that value is equal to number, and otherwise throws RequireCore.exception().

    T

    the type of iterable elements

    value

    the value (must be non-null)

    number

    the required number (must be non-null)

    name

    the name to include in the failure message (must be non-null)

    Definition Classes
    RequireNumericRange
    Annotations
    @inline()
    Exceptions thrown

    RuntimeException if test fails

  41. def requireNumberFrom[T](value: T, leftBound: BoundedNumber[T], name: String = NoNameParameter)(implicit arg0: Numeric[T]): Unit

    Permalink

    Tests that value is from leftBound until maximum value of type T (inclusive), and otherwise throws RequireCore.exception().

    Tests that value is from leftBound until maximum value of type T (inclusive), and otherwise throws RequireCore.exception().

    T

    the type of value

    value

    the value (must be non-null)

    leftBound

    the left bound (must be non-null)

    name

    the name to include in the failure message (must be non-null)

    Definition Classes
    RequireNumericRange
    Annotations
    @inline()
    Exceptions thrown

    RuntimeException if test fails

  42. def requireNumberInRange[T](value: T, leftBound: BoundedNumber[T], rightBound: BoundedNumber[T], name: String = NoNameParameter)(implicit arg0: Numeric[T]): Unit

    Permalink

    Tests that value is from leftBound until rightBound, and otherwise throws RequireCore.exception().

    Tests that value is from leftBound until rightBound, and otherwise throws RequireCore.exception().

    T

    the type of value

    value

    the value (must be non-null)

    leftBound

    the left bound (must be non-null)

    rightBound

    the right bound (must be non-null)

    Definition Classes
    RequireNumericRange
    Annotations
    @inline()
    Exceptions thrown

    RuntimeException if test fails

  43. def requireNumberUntil[T](value: T, rightBound: BoundedNumber[T], name: String = NoNameParameter)(implicit arg0: Numeric[T]): Unit

    Permalink

    Tests that value is from minimum value of type T (inclusive) until rightBound, and otherwise throws RequireCore.exception().

    Tests that value is from minimum value of type T (inclusive) until rightBound, and otherwise throws RequireCore.exception().

    T

    the type of value

    value

    the value (must be non-null)

    rightBound

    the right bound (must be non-null)

    name

    the name to include in the failure message (must be non-null)

    Definition Classes
    RequireNumericRange
    Annotations
    @inline()
    Exceptions thrown

    RuntimeException if test fails

  44. def requirePattern(value: String, pattern: Regex, name: String = NoNameParameter): Unit

    Permalink

    Tests that value matches regular expression pattern, and otherwise throws RequireCore.exception().

    Tests that value matches regular expression pattern, and otherwise throws RequireCore.exception().

    value

    the value to test (must be non-null)

    pattern

    the pattern to test (must be non-null)

    name

    the name to include in the failure message (must be non-null)

    Definition Classes
    RequireString
    Exceptions thrown

    RuntimeException if test fails

  45. def requirePositive[T](value: T, name: String = NoNameParameter)(implicit arg0: Numeric[T]): Unit

    Permalink

    Tests that value is positive, and otherwise throws RequireCore.exception().

    Tests that value is positive, and otherwise throws RequireCore.exception().

    value

    the value to test (must be non-null)

    name

    the name to include in the failure message (must be non-null)

    Definition Classes
    RequireNumeric
    Exceptions thrown

    RuntimeException if test fails

  46. def requireShort(value: String, name: String = NoNameParameter): Unit

    Permalink

    Tests that value is a Short number string, and otherwise throws IllegalArgumentException.

    Tests that value is a Short number string, and otherwise throws IllegalArgumentException.

    value

    the value to test

    name

    the name to include in the failure message

    Definition Classes
    RequireStringNumeric
  47. def requireSize[T](value: Iterable[T], size: Int, name: String = NoNameParameter): Unit

    Permalink

    Tests that size of iterable value equals size, and otherwise throws RequireCore.exception().

    Tests that size of iterable value equals size, and otherwise throws RequireCore.exception().

    T

    the type of iterable elements

    value

    the iterable value (must be non-null)

    size

    the expected size (must be positive)

    name

    the name to include in the failure message (must be non-null)

    Definition Classes
    RequireSize
    Annotations
    @inline()
    Exceptions thrown

    RuntimeException if test fails

  48. def requireSizeFrom[T](value: Iterable[T], from: Int, name: String = NoNameParameter): Unit

    Permalink

    Tests that size of iterable value is from from inclusive until Int.MaxValue inclusive, and otherwise throws RequireCore.exception().

    Tests that size of iterable value is from from inclusive until Int.MaxValue inclusive, and otherwise throws RequireCore.exception().

    T

    the type of iterable elements

    value

    the iterable value (must be non-null)

    from

    the minimum size value (inclusive)

    name

    the name to include in the failure message (must be non-null)

    Definition Classes
    RequireSize
    Annotations
    @inline()
    Exceptions thrown

    RuntimeException if test fails

  49. def requireSizeInRange[T](value: Iterable[T], from: Int, until: Int, name: String = NoNameParameter): Unit

    Permalink

    Tests that size of iterable value is from from inclusive until until exclusive, and otherwise throws RequireCore.exception().

    Tests that size of iterable value is from from inclusive until until exclusive, and otherwise throws RequireCore.exception().

    T

    the type of iterable elements

    value

    the iterable value (must be non-null)

    from

    the minimum size value (inclusive)

    until

    the maximum size value (exclusive)

    name

    the name to include in the failure message (must be non-null)

    Definition Classes
    RequireSize
    Annotations
    @inline()
    Exceptions thrown

    RuntimeException if test fails

  50. def requireSizeUntil[T](value: Iterable[T], until: Int, name: String = NoNameParameter): Unit

    Permalink

    Tests that size of iterable value is from 0 inclusive until until exclusive, and otherwise throws RequireCore.exception().

    Tests that size of iterable value is from 0 inclusive until until exclusive, and otherwise throws RequireCore.exception().

    T

    the type of iterable elements

    value

    the iterable value (must be non-null)

    until

    the maximum size value (exclusive)

    name

    the name to include in the failure message (must be non-null)

    Definition Classes
    RequireSize
    Annotations
    @inline()
    Exceptions thrown

    RuntimeException if test fails

  51. def requireUuid(uuid: String, name: String = NoNameParameter): Unit

    Permalink

    Tests that string uuid is a correct universally unique identifier (UUID), and otherwise throws RequireCore.exception().

    Tests that string uuid is a correct universally unique identifier (UUID), and otherwise throws RequireCore.exception().

    uuid

    the testing uuid string (must be non-null)

    name

    the name to include in the failure message (must be non-null)

    Definition Classes
    RequireStringFormat
    Annotations
    @inline()
    Exceptions thrown

    RuntimeException if test fails

  52. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  53. def toString(): String

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

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from RequireStringNumeric

Inherited from RequireStringFormat

Inherited from RequireSize

Inherited from RequireOptional

Inherited from RequireNumericRange

Inherited from RequireNumeric

Inherited from RequireIterable

Inherited from RequireAllSpecific

Inherited from RequireString

Inherited from RequireAny

Inherited from RequireAll

Inherited from RequireCore

Inherited from AnyRef

Inherited from Any

Ungrouped