Interface LongValidator
- All Superinterfaces:
ComparableComponent<LongValidator,
,Long> NegativeNumberComponent<LongValidator>
,ObjectComponent<LongValidator,
,Long> PositiveNumberComponent<LongValidator>
,ValidatorComponent<LongValidator,
,Long> ZeroNumberComponent<LongValidator>
public interface LongValidator
extends ValidatorComponent<LongValidator,Long>, NegativeNumberComponent<LongValidator>, ZeroNumberComponent<LongValidator>, PositiveNumberComponent<LongValidator>, ObjectComponent<LongValidator,Long>, ComparableComponent<LongValidator,Long>
Validates the state of a
Long
.-
Method Summary
Modifier and TypeMethodDescriptionisBetween
(long minimum, boolean minimumIsInclusive, long maximum, boolean maximumIsInclusive) Ensures that the value is within a range.isBetween
(long minimumInclusive, long maximumExclusive) Ensures that the value is within a range.isGreaterThan
(long minimumExclusive) Ensures that the value is greater than a lower bound.isGreaterThan
(long minimumExclusive, String name) Ensures that the value is greater than a lower bound.isGreaterThanOrEqualTo
(long minimumInclusive) Ensures that the value is greater than or equal to a minimum value.isGreaterThanOrEqualTo
(long minimumInclusive, String name) Ensures that the value is greater than or equal a minimum value.isLessThan
(long maximumExclusive) Ensures that the value is less than an upper bound.isLessThan
(long maximumExclusive, String name) Ensures that the value is less than an upper bound.isLessThanOrEqualTo
(long maximumInclusive) Ensures that the value is less than or equal to a maximum value.isLessThanOrEqualTo
(long maximumInclusive, String name) Ensures that the value is less than or equal to a maximum value.isMultipleOf
(long factor) Ensures that the value is a multiple offactor
.isMultipleOf
(long factor, String name) Ensures that the value is a multiple offactor
.isNotMultipleOf
(long factor) Ensures that the value is not a multiple offactor
.isNotMultipleOf
(long factor, String name) Ensures that the value is not a multiple offactor
.Methods declared in interface com.github.cowwoc.requirements10.java.validator.component.ComparableComponent
isBetween, isBetween, isGreaterThan, isGreaterThan, isGreaterThanOrEqualTo, isGreaterThanOrEqualTo, isLessThan, isLessThan, isLessThanOrEqualTo, isLessThanOrEqualTo
Methods declared in interface com.github.cowwoc.requirements10.java.validator.component.NegativeNumberComponent
isNegative, isNotNegative
Methods declared in interface com.github.cowwoc.requirements10.java.validator.component.ObjectComponent
getValue, isEqualTo, isEqualTo, isInstanceOf, isInstanceOf, isNotEqualTo, isNotEqualTo, isNotInstanceOf, isNotInstanceOf, isNotNull, isNull, isReferenceEqualTo, isReferenceNotEqualTo
Methods declared in interface com.github.cowwoc.requirements10.java.validator.component.PositiveNumberComponent
isNotPositive, isPositive
Methods declared in interface com.github.cowwoc.requirements10.java.validator.component.ValidatorComponent
and, elseGetFailures, elseThrow, getContext, getContextAsString, getName, getValueOrDefault, validationFailed, withContext
Methods declared in interface com.github.cowwoc.requirements10.java.validator.component.ZeroNumberComponent
isNotZero, isZero
-
Method Details
-
isMultipleOf
Ensures that the value is a multiple offactor
.- Parameters:
factor
- the number being multiplied- Returns:
- this
- Throws:
NullPointerException
- if the value is nullIllegalArgumentException
- if the value is not a multiple offactor
-
isMultipleOf
Ensures that the value is a multiple offactor
.- Parameters:
factor
- the number being multipliedname
- the name of the factor- Returns:
- this
- Throws:
NullPointerException
- if the value orname
are nullIllegalArgumentException
- if:name
is emptyname
contains whitespacename
is already in use by the value being validated or the validator context- the value is not a multiple of
factor
-
isNotMultipleOf
Ensures that the value is not a multiple offactor
.- Parameters:
factor
- the number being multiplied- Returns:
- this
- Throws:
NullPointerException
- if the value is nullIllegalArgumentException
- if the value is a multiple offactor
-
isNotMultipleOf
Ensures that the value is not a multiple offactor
.- Parameters:
factor
- the number being multipliedname
- the name of the factor- Returns:
- this
- Throws:
NullPointerException
- if the value orname
are nullIllegalArgumentException
- if:name
is emptyname
contains whitespacename
is already in use by the value being validated or the validator context- the value is a multiple of
factor
-
isLessThan
Ensures that the value is less than an upper bound.- Parameters:
maximumExclusive
- the exclusive upper bound- Returns:
- this
- Throws:
NullPointerException
- if the value is nullIllegalArgumentException
- if the value is greater than or equal tomaximumExclusive
-
isLessThan
Ensures that the value is less than an upper bound.- Parameters:
maximumExclusive
- the exclusive upper boundname
- the name of the upper bound- Returns:
- this
- Throws:
NullPointerException
- if the value orname
are nullIllegalArgumentException
- if:name
is emptyname
contains whitespacename
is already in use by the value being validated or the validator context- the value is greater than or equal to
maximumExclusive
-
isLessThanOrEqualTo
Ensures that the value is less than or equal to a maximum value.- Parameters:
maximumInclusive
- the inclusive upper value- Returns:
- this
- Throws:
NullPointerException
- if the value is nullIllegalArgumentException
- if the value is greater thanmaximumInclusive
-
isLessThanOrEqualTo
Ensures that the value is less than or equal to a maximum value.- Parameters:
maximumInclusive
- the maximum valuename
- the name of the maximum value- Returns:
- this
- Throws:
NullPointerException
- if the value orname
are nullIllegalArgumentException
- if:name
is emptyname
contains whitespacename
is already in use by the value being validated or the validator context- the value is greater than
maximumInclusive
-
isGreaterThanOrEqualTo
Ensures that the value is greater than or equal to a minimum value.- Parameters:
minimumInclusive
- the minimum value- Returns:
- this
- Throws:
NullPointerException
- if the value is nullIllegalArgumentException
- if the value is less thanminimumInclusive
-
isGreaterThanOrEqualTo
Ensures that the value is greater than or equal a minimum value.- Parameters:
minimumInclusive
- the minimum valuename
- the name of the minimum value- Returns:
- this
- Throws:
NullPointerException
- if the value orname
are nullIllegalArgumentException
- if:name
is emptyname
contains whitespacename
is already in use by the value being validated or the validator context- the value is less than
minimumInclusive
-
isGreaterThan
Ensures that the value is greater than a lower bound.- Parameters:
minimumExclusive
- the exclusive lower bound- Returns:
- this
- Throws:
NullPointerException
- if the value is nullIllegalArgumentException
- if the value is less than or equal tominimumExclusive
-
isGreaterThan
Ensures that the value is greater than a lower bound.- Parameters:
minimumExclusive
- the exclusive lower boundname
- the name of the lower bound- Returns:
- this
- Throws:
NullPointerException
- if the value orname
are nullIllegalArgumentException
- if:name
is emptyname
contains whitespacename
is already in use by the value being validated or the validator context- the value is less or equal to
minimumExclusive
-
isBetween
Ensures that the value is within a range.- Parameters:
minimumInclusive
- the lower bound of the range (inclusive)maximumExclusive
- the upper bound of the range (exclusive)- Returns:
- this
- Throws:
NullPointerException
- if the value is nullIllegalArgumentException
- if:minimumInclusive
is greater thanmaximumExclusive
- the value is greater than or equal to
maximumExclusive
-
isBetween
LongValidator isBetween(long minimum, boolean minimumIsInclusive, long maximum, boolean maximumIsInclusive) Ensures that the value is within a range.- Parameters:
minimum
- the lower bound of the rangeminimumIsInclusive
-true
if the lower bound of the range is inclusivemaximum
- the upper bound of the rangemaximumIsInclusive
-true
if the upper bound of the range is inclusive- Returns:
- this
- Throws:
NullPointerException
- if the value is nullIllegalArgumentException
- if:minimum
is greater thanmaximum
minimumIsInclusive
istrue
and the value is less thanminimum
minimumIsInclusive
isfalse
and the value is less than or equal tominimum
maximumIsInclusive
istrue
and the value is greater thanmaximum
maximumIsInclusive
isfalse
and the value is greater than or equal tomaximum
-