public final class PreConditions
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static void |
assertArgument(boolean expression,
java.lang.String msg) |
static Buffer |
assertNotEmpty(Buffer reference,
java.lang.String msg)
Assert that the
Buffer is not null nor empty. |
static java.lang.String |
assertNotEmpty(java.lang.String reference,
java.lang.String msg) |
static <T> T |
assertNotNull(T reference) |
static <T> T |
assertNotNull(T reference,
java.lang.String msg) |
static boolean |
checkIfEmpty(java.lang.String string)
Check if a string is empty, which includes null check.
|
static boolean |
checkIfNotEmpty(java.lang.String string) |
static <T> T |
ifNull(T reference,
T defaultValue)
If our reference is null then return a default value instead.
|
public static <T> T assertNotNull(T reference, java.lang.String msg) throws SipParseException
SipParseException
public static <T> T assertNotNull(T reference) throws SipParseException
SipParseException
public static boolean checkIfEmpty(java.lang.String string)
string
- public static boolean checkIfNotEmpty(java.lang.String string)
public static java.lang.String assertNotEmpty(java.lang.String reference, java.lang.String msg) throws SipParseException
SipParseException
public static void assertArgument(boolean expression, java.lang.String msg) throws SipParseException
SipParseException
public static Buffer assertNotEmpty(Buffer reference, java.lang.String msg) throws SipParseException
Buffer
is not null nor empty.reference
- msg
- java.lang.IllegalArgumentException
SipParseException
public static <T> T ifNull(T reference, T defaultValue)
reference
- the thing to check.defaultValue
- the default value to return if the above reference is null.assertNotNull(Object, String)
if you want to make sure you have a non-null
value for the default value.Copyright © 2014. All Rights Reserved.