@PublicApi public final class Assertions extends Object
com.atlassian.jira.util.dbcNull
.Modifier and Type | Method and Description |
---|---|
static <C extends Iterable<String>> |
containsNoBlanks(String name,
C stringsNotBlank)
Throw and IllegalArgumentException if the passed collection is null or contains any blank
Strings.
|
static <C extends Iterable<?>> |
containsNoNulls(String name,
C containsNoNulls)
Throw an IllegalArgumentException if the passed collection is null or contains any null values.
|
static <C> C[] |
containsNoNulls(String name,
C[] containsNoNulls)
Throw an IllegalArgumentException if the passed array is null or contains any null values.
|
static <T> T |
equals(String name,
T expected,
T got) |
static void |
is(String name,
boolean condition)
Throw an IllegalArgumentException if the condition is false
|
static long |
nonNegative(String name,
long nonNegative) |
static void |
not(String name,
boolean condition)
Throw an IllegalArgumentException if the condition is true
|
static String |
notBlank(String name,
String string)
Throw an IllegalArgumentException if the string is null or blank (only contains whitespace)
|
static <T extends Collection> |
notEmpty(String name,
T notEmpty)
Throw an IllegalArgumentException if the argument is null or empty
|
static <T> T |
notNull(String name,
T notNull)
Throw an IllegalArgumentException if the string is null
|
static <T> T |
notNull(T notNull) |
static void |
stateFalse(String name,
boolean condition)
State check.
|
static <T> T |
stateNotNull(String name,
T notNull)
State check.
|
static void |
stateTrue(String name,
boolean condition)
State check.
|
static String |
stripNotBlank(String name,
String string)
Either returns a string with all space trimmed or throws an IllegalArgumentException if the string is
null or blank (only contains whitespace).
|
public static <T> T notNull(String name, T notNull) throws IllegalArgumentException
name
- added to the exceptionnotNull
- should not be nullIllegalArgumentException
- if nullpublic static <T> T notNull(T notNull) throws IllegalArgumentException
IllegalArgumentException
public static <T extends Collection> T notEmpty(String name, T notEmpty) throws IllegalArgumentException
name
- added to the exceptionnotEmpty
- should not be null or emptyIllegalArgumentException
- if null or emptypublic static <C extends Iterable<?>> C containsNoNulls(String name, C containsNoNulls) throws IllegalArgumentException
name
- name added to the exception.containsNoNulls
- the collection to check.IllegalArgumentException
- if the passed collection is null or contains any null.public static <C> C[] containsNoNulls(String name, C[] containsNoNulls) throws IllegalArgumentException
name
- name added to the exception.containsNoNulls
- the collection to check.IllegalArgumentException
- if the passed collection is null or contains any null.public static String notBlank(String name, String string) throws IllegalArgumentException
name
- added to the exceptionstring
- should not be null or blankIllegalArgumentException
- if null or blankpublic static String stripNotBlank(String name, String string) throws IllegalArgumentException
name
- added to the exceptionstring
- should not be null or blankIllegalArgumentException
- if null or blankpublic static <C extends Iterable<String>> C containsNoBlanks(String name, C stringsNotBlank)
C
- the type of the collection of strings.name
- name added to the exceptionstringsNotBlank
- the collection of strings that should not be blank.IllegalArgumentException
- if the passed collection is null or contains any blank strings.public static void not(String name, boolean condition) throws IllegalArgumentException
name
- added to the exceptioncondition
- should be falseIllegalArgumentException
- if truepublic static void is(String name, boolean condition) throws IllegalArgumentException
name
- added to the exceptioncondition
- should be falseIllegalArgumentException
- if truepublic static void stateTrue(String name, boolean condition) throws IllegalStateException
name
- added to the exceptioncondition
- should be trueIllegalStateException
- if falsepublic static void stateFalse(String name, boolean condition) throws IllegalStateException
name
- added to the exceptioncondition
- should be trueIllegalStateException
- if falsepublic static <T> T stateNotNull(String name, T notNull)
name
- added to the exceptionnotNull
- should not be nullIllegalStateException
- if falsepublic static <T> T equals(String name, T expected, T got) throws IllegalArgumentException
IllegalArgumentException
public static long nonNegative(String name, long nonNegative) throws IllegalArgumentException
IllegalArgumentException
Copyright © 2002-2017 Atlassian. All Rights Reserved.