|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.atlassian.jira.util.dbc.Assertions
public final class Assertions
Utility class with design by contract checks. Should be preferred to com.atlassian.jira.util.dbcNull.
| Method Summary | ||
|---|---|---|
static
|
containsNoBlanks(String name,
C stringsNotBlank)
Throw and IllegalArgumentException if the passed collection is null or contains any blank Strings. |
|
static
|
containsNoNulls(String name,
C containsNoNulls)
Throw an IllegalArgumentException if the passed collection is null or contains any null values. |
|
static
|
containsNoNulls(String name,
C[] containsNoNulls)
Throw an IllegalArgumentException if the passed array is null or contains any null values. |
|
static
|
equals(String name,
T expected,
T got)
|
|
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
|
notEmpty(String name,
T notEmpty)
Throw an IllegalArgumentException if the argument is null or empty |
|
static
|
notNull(String name,
T notNull)
Throw an IllegalArgumentException if the string is null |
|
static
|
stateNotNull(String name,
T notNull)
State check. |
|
static void |
stateTrue(String name,
boolean condition)
State check. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static <T> T notNull(String name,
T notNull)
throws IllegalArgumentException
name - added to the exceptionnotNull - should not be null
IllegalArgumentException - if null
public static <T extends Collection> T notEmpty(String name,
T notEmpty)
throws IllegalArgumentException
name - added to the exceptionnotEmpty - should not be null or empty
IllegalArgumentException - if null or empty
public 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 blank
IllegalArgumentException - if null or blank
public 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 false
IllegalArgumentException - if true
public static void stateTrue(String name,
boolean condition)
throws IllegalStateException
name - added to the exceptioncondition - should be true
IllegalStateException - if false
public static <T> T stateNotNull(String name,
T notNull)
name - added to the exceptionnotNull - should not be null
IllegalStateException - if false
public static <T> T equals(String name,
T expected,
T got)
throws IllegalArgumentException
IllegalArgumentException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||