| Constructor and Description |
|---|
Args() |
| Modifier and Type | Method and Description |
|---|---|
static void |
checkForContent(String aText)
Throw an IllegalArgumentException if aText does not
satisfy
Util.textHasContent(java.lang.String). |
static void |
checkForEmpty(Collection<Object> aCollection)
Throw an IllegalArgumentException only if aCollection.isEmpty
returns true.
|
static void |
checkForNull(Object aObject)
If aObject is null, throw a NullPointerException.
|
static void |
checkForRange(int aNumber,
int aLow,
int aHigh)
Throw an IllegalArgumentException if
Util.isInRange(int, int, int)
returns false. |
public Args()
public static void checkForNull(Object aObject)
Use cases :
doSomething( SoccerBall aBall ){
//call some method on the argument :
//if aBall is null, then exception is automatically thrown, so
//there is no need for an explicit check for null.
aBall.inflate();
//assign to a corresponding field (common in constructors):
//if aBall is null, no exception is immediately thrown, so
//an explicit check for null may be useful here
Args.checkForNull( aBall );
fBall = aBall;
//passed on to some other method as param :
//it may or may not be appropriate to have an explicit check
//for null here, according the needs of the problem
Args.checkForNull( aBall ); //??
fReferee.verify( aBall );
}
public static void checkForContent(String aText)
Util.textHasContent(java.lang.String).
Most text used in an application is meaningful only if it has visible content.
public static void checkForRange(int aNumber, int aLow, int aHigh)
Util.isInRange(int, int, int)
returns false.aLow - is less than or equal to aHigh.public static void checkForEmpty(Collection<Object> aCollection)
Copyright Hirondelle Systems - License - Generated 2013Sep20.10.58