Package com.couchbase.client.core.util
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 Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> TnotNull(T input, String identifier)Check if the given input is not null.static <T> TnotNull(T input, String identifier, Supplier<ErrorContext> errorContext)static StringnotNullOrEmpty(String input, String identifier)Check if the given string is not null or empty.static StringnotNullOrEmpty(String input, String identifier, Supplier<ErrorContext> errorContext)static <T> Collection<T>notNullOrEmpty(Collection<T> input, String identifier)static <T> List<T>notNullOrEmpty(List<T> input, String identifier)static <T> List<T>notNullOrEmpty(List<T> input, String identifier, Supplier<ErrorContext> errorContext)static <T> Set<T>notNullOrEmpty(Set<T> input, String identifier)static <T> Set<T>notNullOrEmpty(Set<T> input, String identifier, Supplier<ErrorContext> errorContext)
-
-
-
Method Detail
-
notNull
public static <T> T notNull(T input, String identifier)Check if the given input is not null.If it is null, a
InvalidArgumentExceptionis 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
InvalidArgumentExceptionis 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 <T> List<T> notNullOrEmpty(List<T> input, String identifier, Supplier<ErrorContext> errorContext)
-
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)
-
-