public final class Sanity extends Object
Modifier and Type | Method and Description |
---|---|
static <Type> Type[] |
nullCheck(Type[] array,
String failMessage)
Checks if an array is null or contains null elements.
|
static <Type> Type |
nullCheck(Type object,
String failMessage)
Checks if an object is null.
|
static String |
safeMessageCheck(String message)
Checks if a message contains CR, LF, or NUL.
|
static String |
safeMessageCheck(String message,
String name)
Checks if a string contains CR, LF, or NUL.
|
static void |
truthiness(boolean bool,
String failMessage)
Checks if a boolean is true.
|
@Nonnull public static <Type> Type nullCheck(@Nullable Type object, @Nonnull String failMessage)
Type
- type of object checkedobject
- object to checkfailMessage
- message to throwIllegalArgumentException
- if the object is null@Nonnull public static <Type> Type[] nullCheck(@Nullable Type[] array, @Nonnull String failMessage)
Type
- type of object checkedarray
- array to checkfailMessage
- message to throwIllegalArgumentException
- if null or contains null elementspublic static void truthiness(boolean bool, @Nonnull String failMessage)
bool
- value to testfailMessage
- message to throwIllegalArgumentException
- if false@Nonnull public static String safeMessageCheck(@Nonnull String message)
message
- message to checkIllegalArgumentException
- if foundCopyright © 2013–2019 Kitteh. All rights reserved.