public class Util extends Object
Modifier and Type | Method and Description |
---|---|
static Object[] |
requireNonEmpty(Object[] array)
Checks that the provided string is not empty.
|
static Object[] |
requireNonEmpty(Object[] array,
String message)
Checks that the provided string is not empty.
|
static String |
requireNonEmpty(String str)
Checks that the provided string is not empty.
|
static String |
requireNonEmpty(String str,
String message)
Checks that the provided string is not empty.
|
static void |
requirePatternMatch(Pattern pattern,
String str,
String message)
Checks that the provided string matches the provided pattern.
|
public static String requireNonEmpty(String str)
str
- the string to checkNullPointerException
- if the provided string is null
IllegalArgumentException
- if the provided string is emptypublic static String requireNonEmpty(String str, String message)
str
- the string to checkmessage
- the exception message to useNullPointerException
- if the provided string is null
IllegalArgumentException
- if the provided string is emptypublic static Object[] requireNonEmpty(Object[] array)
array
- the array to checkNullPointerException
- if the provided array is null
IllegalArgumentException
- if the provided array is zero lengthpublic static Object[] requireNonEmpty(Object[] array, String message)
array
- the array to checkmessage
- the exception message to useNullPointerException
- if the provided array is null
IllegalArgumentException
- if the provided string is zero lengthpublic static void requirePatternMatch(Pattern pattern, String str, String message)
pattern
- the pattern to match againststr
- the string to checkmessage
- the exception message to useNullPointerException
- if the provided string is null
IllegalArgumentException
- if the provided string is empty or if the string doesn't match the patternCopyright © 2020 National Institute of Standards and Technology. All rights reserved.