Class Validator


  • public final class Validator
    extends java.lang.Object
    Used internally to validate parameters
    Since:
    1.3
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> T requireNonNull​(T obj)
      Checks that the specified object reference is not null and and throws IllegalArgumentException if it is.
      static <T> T requireNonNull​(T obj, java.lang.String message)
      Checks that the specified object reference is not null and throws a customized IllegalArgumentException if it is.
      • Methods inherited from class java.lang.Object

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

      • requireNonNull

        public static <T> T requireNonNull​(T obj)
        Checks that the specified object reference is not null and and throws IllegalArgumentException if it is.
        Essentially this is very much the same as Objects.requireNonNull(Object) but throws an IllegalArgumentException as opposed to the NullPointerException the SDK class throws.
        Type Parameters:
        T - The type of the object
        Parameters:
        obj - The object to be validated
        Returns:
        The provided object in case it was non-null
        Throws:
        java.lang.IllegalArgumentException - If the provided object was null
        Since:
        1.3
      • requireNonNull

        public static <T> T requireNonNull​(T obj,
                                           java.lang.String message)
        Checks that the specified object reference is not null and throws a customized IllegalArgumentException if it is.
        Essentially this is very much the same as Objects.requireNonNull(Object, String) but throws an IllegalArgumentException as opposed to the NullPointerException the SDK class throws.
        Type Parameters:
        T - The type of the object
        Parameters:
        obj - The object to be validated
        message - detail message to be used in the event that a IllegalArgumentException is thrown
        Returns:
        The provided object in case it was non-null
        Throws:
        java.lang.IllegalArgumentException - If the provided object was null
        Since:
        1.3