Interface Preconditions


public interface Preconditions
Utility interface providing static precondition checks for method arguments.

Preconditions are checked at the entry point of a method or constructor to ensure that supplied arguments meet requirements before any work is performed.

See Also:
  • Method Summary

    Static Methods
    Modifier and Type
    Method
    Description
    static <T> void
    requireNonNull(T object, String message)
    Asserts that object is not null, throwing a NullPointerException with the given message if it is.
  • Method Details

    • requireNonNull

      static <T> void requireNonNull(T object, String message)
      Asserts that object is not null, throwing a NullPointerException with the given message if it is.
      Type Parameters:
      T - the type of the object being checked
      Parameters:
      object - the value to check; must not be null
      message - the detail message for the exception if the check fails
      Throws:
      NullPointerException - if object is null