|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.afcs.warts.util.ValidationUtils
The ValidationUtils class contains various utility methods for validating values. These can be used for convenient argument checking.
LICENSE: This code is released to the public domain and may be used for any purpose whatsoever without permission or acknowledgment.
Method Summary | |
static void |
checkArrayIndex(java.lang.String name,
int index,
int arrayLength)
Checks that the specified index can be used to reference objects in an array of the specified length, throwing an IllegalArgumentException with the specified name if not. |
static void |
checkIndexInRange(java.lang.String name,
int index,
int minValue,
int maxValue)
Checks that the specified index is within the specified range, throwing an IllegalArgumentException with the specified name if not. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static void checkArrayIndex(java.lang.String name, int index, int arrayLength)
name
- The name of the index being checked (usually the name of
the variable in the calling method). This is used in the
message of the thrown exception.index
- The index to check.arrayLength
- The length of the array that the index refers to.
java.lang.IllegalArgumentException
- If index is less than 0 or greater
than arrayLength-1.public static void checkIndexInRange(java.lang.String name, int index, int minValue, int maxValue)
name
- The name of the index being checked (usually the name of
the variable in the calling method). This is used in the
message of the thrown exception.index
- The index to check.minValue
- The minimum legal value for index.maxValue
- The maximum legal value for index.
java.lang.IllegalArgumentException
- If index is less than minValue or greater
than maxValue.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |