public class Validators extends Object
Modifier and Type | Method and Description |
---|---|
static <T> T |
notNull(T input,
String identifier)
Check if the given input is not null.
|
static <T> T |
notNull(T input,
String identifier,
Supplier<ErrorContext> errorContext) |
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) |
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) |
public static <T> T notNull(T input, String identifier)
If it is null, a InvalidArgumentException
is raised with a proper message.
input
- the input to check.identifier
- the identifier that is part of the exception message.public static <T> T notNull(T input, String identifier, Supplier<ErrorContext> errorContext)
public static String notNullOrEmpty(String input, String identifier)
If it is null or empty, a InvalidArgumentException
is raised with a
proper message.
input
- the string to check.identifier
- the identifier that is part of the exception message.public static String notNullOrEmpty(String input, String identifier, Supplier<ErrorContext> errorContext)
public static <T> List<T> notNullOrEmpty(List<T> input, String identifier, Supplier<ErrorContext> errorContext)
public static <T> Set<T> notNullOrEmpty(Set<T> input, String identifier, Supplier<ErrorContext> errorContext)
Copyright © 2020 Couchbase, Inc.. All rights reserved.