public class ArgCheck extends Object
#java.lang.IllegalArgumentException
.Modifier and Type | Method and Description |
---|---|
static void |
contains(Collection collection,
Object value)
Check that the collection contains the value
|
static void |
contains(Collection collection,
Object value,
String message)
Check that the collection contains the value
|
static void |
containsKey(Map map,
Object key)
Check that the map contains the key
|
static void |
containsKey(Map map,
Object key,
String message)
Check that the map contains the key
|
static void |
isInstanceOf(Class theClass,
Object value)
Check that the object is an instance of the specified Class
|
static void |
isInstanceOf(Class theClass,
Object value,
String message)
Check that the object is an instance of the specified Class
|
static void |
isNegative(int value)
Check that the value is negative (<0).
|
static void |
isNegative(int value,
String message)
Check that the value is negative (<0).
|
static void |
isNegative(long value)
Check that the value is negative (<0).
|
static void |
isNegative(long value,
String message)
Check that the value is negative (<0).
|
static void |
isNonNegative(int value)
Check that the value is non-negative (>=0).
|
static void |
isNonNegative(int value,
String message)
Check that the value is non-negative (>=0).
|
static void |
isNonNegative(long value)
Check that the value is non-negative (>=0).
|
static void |
isNonNegative(long value,
String message)
Check that the value is non-negative (>=0).
|
static void |
isNonPositive(int value)
Check that the value is non-positive (<=0).
|
static void |
isNonPositive(int value,
String message)
Check that the value is non-positive (<=0).
|
static void |
isNonPositive(long value)
Check that the value is non-positive (<=0).
|
static void |
isNonPositive(long value,
String message)
Check that the value is non-positive (<=0).
|
static void |
isNotEmpty(Collection collection)
Check that the collection is not empty
|
static void |
isNotEmpty(Collection collection,
String message)
Check that the collection is not empty
|
static void |
isNotEmpty(Map map)
Check that the map is not empty
|
static void |
isNotEmpty(Map map,
String message)
Check that the map is not empty
|
static void |
isNotEmpty(Object[] array)
Check that the array is not empty
|
static void |
isNotEmpty(Object[] array,
String message)
Check that the array is not empty
|
static void |
isNotEmpty(String string)
Check that the string is not empty
|
static void |
isNotEmpty(String string,
String message)
Check that the string is not empty
|
static void |
isNotNull(Object value)
Check that the object is non-null
|
static void |
isNotNull(Object value,
String message)
Check that the object is non-null
|
static void |
isNotSame(Object firstObject,
String firstName,
Object secondObject,
String secondName)
Asserts that the specified first object is not the same as (==) the specified second object.
|
static void |
isNotZeroLength(String value)
Check that the string is non-null and has length > 0
|
static void |
isNotZeroLength(String value,
String message)
Check that the string is non-null and has length > 0
|
static void |
isNull(Object value)
Check that the object is null
|
static void |
isNull(Object value,
String message)
Check that the object is null
|
static void |
isPositive(int value)
Check that the value is positive (>0).
|
static void |
isPositive(int value,
String message)
Check that the value is positive (>0).
|
static void |
isPositive(long value)
Check that the value is positive (>0).
|
static void |
isPositive(long value,
String message)
Check that the value is positive (>0).
|
static void |
isTrue(boolean condition,
String message)
Check that the boolean condition is true; throw an
IllegalArgumentException if not.
|
public static final void isTrue(boolean condition, String message)
condition
- The boolean condition to checkmessage
- Exception message if check failsIllegalArgumentException
- if condition is falsepublic static final void isNonNegative(int value)
value
- ValueIllegalArgumentException
- If value is negative (<0)public static final void isNonNegative(int value, String message)
value
- Valuemessage
- Exception message if check failsIllegalArgumentException
- If value is negative (<0)public static final void isNonPositive(int value)
value
- ValueIllegalArgumentException
- If value is positive (>0)public static final void isNonPositive(int value, String message)
value
- Valuemessage
- Exception message if check failsIllegalArgumentException
- If value is positive (>0)public static final void isNegative(int value)
value
- ValueIllegalArgumentException
- If value is non-negative (>=0)public static final void isNegative(int value, String message)
value
- Valuemessage
- Exception message if check failsIllegalArgumentException
- If value is non-negative (>=0)public static final void isPositive(int value)
value
- ValueIllegalArgumentException
- If value is non-positive (<=0)public static final void isPositive(int value, String message)
value
- Valuemessage
- Exception message if check failsIllegalArgumentException
- If value is non-positive (<=0)public static final void isNonNegative(long value)
value
- ValueIllegalArgumentException
- If value is negative (<0)public static final void isNonNegative(long value, String message)
value
- Valuemessage
- Exception message if check failsIllegalArgumentException
- If value is negative (<0)public static final void isNonPositive(long value)
value
- ValueIllegalArgumentException
- If value is positive (>0)public static final void isNonPositive(long value, String message)
value
- Valuemessage
- Exception message if check failsIllegalArgumentException
- If value is positive (>0)public static final void isNegative(long value)
value
- ValueIllegalArgumentException
- If value is non-negative (>=0)public static final void isNegative(long value, String message)
value
- Valuemessage
- Exception message if check failsIllegalArgumentException
- If value is non-negative (>=0)public static final void isPositive(long value)
value
- ValueIllegalArgumentException
- If value is non-positive (<=0)public static final void isPositive(long value, String message)
value
- Valuemessage
- Exception message if check failsIllegalArgumentException
- If value is non-positive (<=0)public static final void isNotZeroLength(String value)
value
- ValueIllegalArgumentException
- If value is null or length == 0public static final void isNotZeroLength(String value, String message)
value
- Valuemessage
- Exception message if check failsIllegalArgumentException
- If value is null or length == 0public static final void isNotNull(Object value)
value
- ValueIllegalArgumentException
- If value is nullpublic static final void isNotNull(Object value, String message)
value
- Valuemessage
- Exception message if check failsIllegalArgumentException
- If value is nullpublic static final void isNull(Object value)
value
- ValueIllegalArgumentException
- If value is non-nullpublic static final void isNull(Object value, String message)
value
- Valuemessage
- Exception message if check failsIllegalArgumentException
- If value is non-nullpublic static final void isInstanceOf(Class theClass, Object value)
theClass
- Classvalue
- ValueIllegalArgumentException
- If value is nullpublic static final void isInstanceOf(Class theClass, Object value, String message)
theClass
- Classvalue
- Valuemessage
- Exception message if check failsIllegalArgumentException
- If value is nullpublic static final void isNotEmpty(Collection collection)
collection
- CollectionIllegalArgumentException
- If collection is null or emptypublic static final void isNotEmpty(Collection collection, String message)
collection
- Collectionmessage
- Exception message if check failsIllegalArgumentException
- If collection is null or emptypublic static final void isNotEmpty(Map map)
map
- MapIllegalArgumentException
- If map is null or emptypublic static final void isNotEmpty(Map map, String message)
map
- Mapmessage
- Exception message if check failsIllegalArgumentException
- If map is null or emptypublic static final void isNotEmpty(Object[] array)
array
- ArrayIllegalArgumentException
- If array is null or emptypublic static final void isNotEmpty(Object[] array, String message)
array
- Arraymessage
- Exception message if check failsIllegalArgumentException
- If array is null or emptypublic static final void isNotEmpty(String string)
string
- StringIllegalArgumentException
- If string is null or emptypublic static final void isNotEmpty(String string, String message)
string
- Stringmessage
- Exception message if check failsIllegalArgumentException
- If string is null or emptypublic static void isNotSame(Object firstObject, String firstName, Object secondObject, String secondName)
firstObject
- The first object to assert as not the same as the second object.firstName
- The name that will be used within the exception message for the first object, should an exception be
thrown; if null and firstObject
is not null, firstObject.toString()
will be
used.secondObject
- The second object to assert as not the same as the first object.secondName
- The name that will be used within the exception message for the second object, should an exception be
thrown; if null and secondObject
is not null, secondObject.toString()
will
be used.IllegalArgumentException
- If the specified objects are the same.public static final void contains(Collection collection, Object value)
collection
- Collection to checkvalue
- Value to check for, may be nullIllegalArgumentException
- If collection is null or doesn't contain valuepublic static final void contains(Collection collection, Object value, String message)
collection
- Collection to checkvalue
- Value to check for, may be nullmessage
- Exception message if check failsIllegalArgumentException
- If collection is null or doesn't contain valuepublic static final void containsKey(Map map, Object key)
map
- Map to checkkey
- Key to check for, may be nullIllegalArgumentException
- If map is null or doesn't contain keypublic static final void containsKey(Map map, Object key, String message)
map
- Map to checkkey
- Key to check for, may be nullmessage
- Exception message if check failsIllegalArgumentException
- If map is null or doesn't contain keyCopyright © 2018 JBoss by Red Hat. All rights reserved.