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