Package org.fest.util

Class Preconditions

java.lang.Object
org.fest.util.Preconditions

public final class Preconditions extends Object
Verifies correct argument values and state. Borrowed from Guava.
Author:
alruiz@google.com (Alex Ruiz)
  • Method Details

    • checkNotNullOrEmpty

      public static String checkNotNullOrEmpty(String s)
      Verifies that the given String is not null or empty.
      Parameters:
      s - the given String.
      Returns:
      the validated String.
      Throws:
      NullPointerException - if the given String is null.
      IllegalArgumentException - if the given String is empty.
    • checkNotNull

      public static <T> T checkNotNull(T reference)
      Verifies that the given object reference is not null.
      Parameters:
      reference - the given object reference.
      Returns:
      the non-null reference that was validated.
      Throws:
      NullPointerException - if the given object reference is null.