Package org.fest.util

Class Preconditions


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

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> T checkNotNull​(T reference)
      Verifies that the given object reference is not null.
      static java.lang.String checkNotNullOrEmpty​(java.lang.String s)
      Verifies that the given String is not null or empty.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • checkNotNullOrEmpty

        public static java.lang.String checkNotNullOrEmpty​(java.lang.String s)
        Verifies that the given String is not null or empty.
        Parameters:
        s - the given String.
        Returns:
        the validated String.
        Throws:
        java.lang.NullPointerException - if the given String is null.
        java.lang.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:
        java.lang.NullPointerException - if the given object reference is null.