C - The type of the concrete check class. This parameter is necessary
for this base class to define methods that return the check object
itself (with the correct static type), which is necessary for the
fluent interface of all checks.@GwtCompatible public abstract class BaseCheck<C extends BaseCheck<C>> extends Object
ObjectBaseCheck
and PrimitiveBaseCheck.| Modifier and Type | Field and Description |
|---|---|
protected String |
argName
The argument name.
|
protected boolean |
inverted
The inverted flag.
|
| Constructor and Description |
|---|
BaseCheck() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkConversion()
Asserts that the check is not inverted, throwing an
InvalidCheckException otherwise. |
protected C |
me()
Simply casts this check to the
C type parameter (which
should always be equal to the class of the concrete check). |
C |
named(String argumentName)
Gives the argument to be checked a name.
|
C |
not()
Inverts the following check.
|
protected String argName
Exceptions.defaultArgName() and can be changed using the
named(String) modifier method.protected boolean inverted
true, the condition of the next
check must be inverted. It is initialized as false and can
be set with the not() modifier method.
Note that each check must reset this flag to false.
public final C named(String argumentName)
Exceptions.defaultArgName()) is used.argumentName - The name of the argument to be checkedpublic final C not()
Note that the check inversion only affects the explicit check and
not the implicit null check that is done by each check
method of ObjectBaseCheck subclasses. The explicit
isNotNull() check can also be
inverted this way.
protected final void checkConversion()
InvalidCheckException otherwise. This should be done before each
conversion, e.g., with StringCheck.isIntWhich().protected final C me()
C type parameter (which
should always be equal to the class of the concrete check).CCopyright © 2012–2017 Michael Faes. All rights reserved.