Package com.couchbase.client.core.util
Class Validators
java.lang.Object
com.couchbase.client.core.util.Validators
Common validators used throughout the client.
- Since:
- 2.0.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> T
Check if the given input is not null.static <T> T
notNull
(T input, String identifier, Supplier<ErrorContext> errorContext) static byte[]
notNullOrEmpty
(byte[] input, String identifier) static byte[]
notNullOrEmpty
(byte[] input, String identifier, Supplier<ErrorContext> errorContext) static String
notNullOrEmpty
(String input, String identifier) Check if the given string is not null or empty.static String
notNullOrEmpty
(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 Details
-
notNull
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
-
notNullOrEmpty
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
-
notNullOrEmpty
public static byte[] notNullOrEmpty(byte[] input, String identifier, Supplier<ErrorContext> errorContext) -
notNullOrEmpty
-
notNullOrEmpty
public static <T> List<T> notNullOrEmpty(List<T> input, String identifier, Supplier<ErrorContext> errorContext) -
notNullOrEmpty
-
notNullOrEmpty
-
notNullOrEmpty
public static <T> Set<T> notNullOrEmpty(Set<T> input, String identifier, Supplier<ErrorContext> errorContext)
-