Class Validators

java.lang.Object
com.couchbase.client.core.util.Validators

public class Validators extends Object
Common validators used throughout the client.
Since:
2.0.0
  • Method Details

    • notNull

      public static <T> T notNull(T input, String identifier)
      Check if the given input is not null.

      If it is null, a InvalidArgumentException is raised with a proper message.

      Parameters:
      input - the input to check.
      identifier - the identifier that is part of the exception message.
    • notNull

      public static <T> T notNull(T input, String identifier, Supplier<ErrorContext> errorContext)
    • notNullOrEmpty

      public static String notNullOrEmpty(String input, String identifier)
      Check if the given string is not null or empty.

      If it is null or empty, a InvalidArgumentException is raised with a proper message.

      Parameters:
      input - the string to check.
      identifier - the identifier that is part of the exception message.
    • notNullOrEmpty

      public static String notNullOrEmpty(String input, String identifier, Supplier<ErrorContext> errorContext)
    • notNullOrEmpty

      public static byte[] notNullOrEmpty(byte[] input, String identifier)
    • notNullOrEmpty

      public static byte[] notNullOrEmpty(byte[] input, String identifier, Supplier<ErrorContext> errorContext)
    • notNullOrEmpty

      public static <T> List<T> notNullOrEmpty(List<T> input, String identifier)
    • notNullOrEmpty

      public static <T> List<T> notNullOrEmpty(List<T> input, String identifier, Supplier<ErrorContext> errorContext)
    • notNullOrEmpty

      public static <T> Set<T> notNullOrEmpty(Set<T> input, String identifier)
    • notNullOrEmpty

      public static <T> Collection<T> notNullOrEmpty(Collection<T> input, String identifier)
    • notNullOrEmpty

      public static <T> Set<T> notNullOrEmpty(Set<T> input, String identifier, Supplier<ErrorContext> errorContext)