org.beangle.commons.lang

Assert

Related Doc: package lang

object Assert

Assertion tool class

Since

3.0.0

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Assert
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Value Members

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

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

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

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

    Definition Classes
    Any
  5. def clone(): AnyRef

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

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

    Definition Classes
    AnyRef → Any
  8. def finalize(): Unit

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

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

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

    Definition Classes
    Any
  12. def isTrue(expression: Boolean, message: String, values: AnyRef*): Unit

    Validate that the argument condition is true; otherwise throwing an exception with the specified message.

    Validate that the argument condition is true; otherwise throwing an exception with the specified message. This method is useful when validating according to an arbitrary boolean expression, such as validating a primitive number or using your own custom validation expression.

    Assert.isTrue(i >= min && i <= max, "The value must be between %d and %d", min, max);
    Assert.isTrue(myObject.isOk(), "The object is not okay");
    

    expression

    the boolean expression to check

    message

    the Object...) exception message if invalid, not null

    values

    the optional values for the formatted exception message, null array not recommended

    Exceptions thrown

    IllegalArgumentException if expression is false

    See also

    #isTrue(boolean)

  13. def isTrue(expression: Boolean): Unit

    Validate that the argument condition is true; otherwise throwing an exception.

    Validate that the argument condition is true; otherwise throwing an exception. This method is useful when validating according to an arbitrary boolean expression, such as validating a primitive number or using your own custom validation expression.

    Assert.isTrue(i > 0);
    Assert.isTrue(myObject.isOk());
    

    The message of the exception is "The validated expression is false".

    expression

    the boolean expression to check

    Exceptions thrown

    IllegalArgumentException if expression is false

    See also

    #isTrue(boolean, String, Object...)

  14. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  15. def noNullElements[T <: Iterable[_]](iterable: T, message: String, values: AnyRef*): T

    Validate that the specified argument iterable is neither null nor contains any elements that are null; otherwise throwing an exception with the specified message.

    Validate that the specified argument iterable is neither null nor contains any elements that are null; otherwise throwing an exception with the specified message.

    Assert.noNullElements(myCollection, "The collection contains null at position %d");
    

    If the iterable is null, then the message in the exception is "The validated object is null".

    If the iterable has a null element, then the iteration index of the invalid element is appended to the values argument.

    iterable

    the iterable to check, validated not null by this method

    message

    the Object...) exception message if invalid, not null

    values

    the optional values for the formatted exception message, null array not recommended

    returns

    the validated iterable (never null method for chaining)

    Exceptions thrown

    IllegalArgumentException if an element is null

    NullPointerException if the array is null

  16. def notEmpty[T <: CharSequence](chars: T, message: String, values: AnyRef*): T

    Validate that the specified argument character sequence is neither null nor a length of zero (no characters); otherwise throwing an exception with the specified message.

    Validate that the specified argument character sequence is neither null nor a length of zero (no characters); otherwise throwing an exception with the specified message.

    Assert.notEmpty(myString);
    

    The message in the exception is "The validated character sequence is empty".

    chars

    the character sequence to check, validated not null by this method

    returns

    the validated character sequence (never null method for chaining)

    Exceptions thrown

    IllegalArgumentException if the character sequence is empty

    NullPointerException if the character sequence is null

  17. def notEmpty[T <: CharSequence](chars: T): T

    Validate that the specified argument array is neither null nor a length of zero (no elements); otherwise throwing an exception.

    Validate that the specified argument array is neither null nor a length of zero (no elements); otherwise throwing an exception.

    Assert.notEmpty(myArray);
    

    The message in the exception is "The validated array is empty".

    returns

    the validated array (never null method for chaining)

    Exceptions thrown

    IllegalArgumentException if the array is empty

    NullPointerException if the array is null

  18. def notNull[T](value: T, message: String, values: AnyRef*): T

    Validate that the specified argument is not null; otherwise throwing an exception with the specified message.

    Validate that the specified argument is not null; otherwise throwing an exception with the specified message.

    Assert.notNull(myObject, "The object must not be null");
    

    message

    the Object...) exception message if invalid, not null

    values

    the optional values for the formatted exception message

    returns

    the validated object (never null for method chaining)

    Exceptions thrown

    NullPointerException if the object is null

    See also

    #notNull(Object)

  19. def notNull[T](value: T): T

    Validate that the specified argument is not null; otherwise throwing an exception.

    Validate that the specified argument is not null; otherwise throwing an exception.

    Assert.notNull(myObject, "The object must not be null");
    

    The message of the exception is "The validated object is null".

    value

    the object to check

    returns

    the validated object (never null for method chaining)

    Exceptions thrown

    NullPointerException if the object is null

    See also

    #notNull(Object, String, Object...)

  20. final def notify(): Unit

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

    Definition Classes
    AnyRef
  22. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  23. def toString(): String

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

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped