Interface FloatValidator
- All Superinterfaces:
ComparableComponent<FloatValidator,,Float> DecimalNumberComponent<FloatValidator>,FixedPrecisionDecimalNumberComponent<FloatValidator>,NegativeNumberComponent<FloatValidator>,ObjectComponent<FloatValidator,,Float> PositiveNumberComponent<FloatValidator>,ValidatorComponent<FloatValidator,,Float> ZeroNumberComponent<FloatValidator>
public interface FloatValidator
extends ValidatorComponent<FloatValidator,Float>, ObjectComponent<FloatValidator,Float>, NegativeNumberComponent<FloatValidator>, ZeroNumberComponent<FloatValidator>, PositiveNumberComponent<FloatValidator>, FixedPrecisionDecimalNumberComponent<FloatValidator>, DecimalNumberComponent<FloatValidator>, ComparableComponent<FloatValidator,Float>
Validates the state of a
Float.-
Method Summary
Modifier and TypeMethodDescriptionisBetween(float minimum, boolean minimumIsInclusive, float maximum, boolean maximumIsInclusive) Ensures that the value is within a range.isBetween(float minimumInclusive, float maximumExclusive) Ensures that the value is within a range.isGreaterThan(float minimumExclusive) Ensures that the value is greater than a lower bound.isGreaterThan(float minimumExclusive, String name) Ensures that the value is greater than a lower bound.isGreaterThanOrEqualTo(float minimumInclusive) Ensures that the value is greater than or equal to a minimum value.isGreaterThanOrEqualTo(float minimumInclusive, String name) Ensures that the value is greater than or equal a minimum value.isLessThan(float maximumExclusive) Ensures that the value is less than an upper bound.isLessThan(float maximumExclusive, String name) Ensures that the value is less than an upper bound.isLessThanOrEqualTo(float maximumInclusive) Ensures that the value is less than or equal to a maximum value.isLessThanOrEqualTo(float maximumInclusive, String name) Ensures that the value is less than or equal to a maximum value.isMultipleOf(float factor) Ensures that the value is a multiple offactor.isMultipleOf(float factor, String name) Ensures that the value is a multiple offactor.isNotMultipleOf(float factor) Ensures that the value is not a multiple offactor.isNotMultipleOf(float 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, isLessThanOrEqualToMethods declared in interface com.github.cowwoc.requirements10.java.validator.component.DecimalNumberComponent
isNotWholeNumber, isWholeNumberMethods declared in interface com.github.cowwoc.requirements10.java.validator.component.FixedPrecisionDecimalNumberComponent
isFinite, isInfinite, isNotNumber, isNumberMethods declared in interface com.github.cowwoc.requirements10.java.validator.component.NegativeNumberComponent
isNegative, isNotNegativeMethods declared in interface com.github.cowwoc.requirements10.java.validator.component.ObjectComponent
getValue, isEqualTo, isEqualTo, isInstanceOf, isInstanceOf, isNotEqualTo, isNotEqualTo, isNotInstanceOf, isNotInstanceOf, isNotNull, isNull, isReferenceEqualTo, isReferenceNotEqualToMethods declared in interface com.github.cowwoc.requirements10.java.validator.component.PositiveNumberComponent
isNotPositive, isPositiveMethods declared in interface com.github.cowwoc.requirements10.java.validator.component.ValidatorComponent
and, elseGetFailures, elseThrow, getContext, getContextAsString, getName, getValueOrDefault, validationFailed, withContextMethods 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 of
factor - not a number
- not a multiple of
-
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 ornameare nullIllegalArgumentException- if:nameis emptynamecontains whitespacenameis already in use by the value being validated or the validator context- the value is not a multiple of
factor - the value is not a number
-
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 ornameare nullIllegalArgumentException- if:nameis emptynamecontains whitespacenameis 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 to
maximumExclusive - not a number
- greater than or equal to
-
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 ornameare nullIllegalArgumentException- if:nameis emptynamecontains whitespacenameis already in use by the value being validated or the validator context- the value is greater than or equal to
maximumExclusive - the value is not a number
-
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 than
maximumInclusive - not a number
- greater than
-
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 ornameare nullIllegalArgumentException- if:nameis emptynamecontains whitespacenameis already in use by the value being validated or the validator context- the value is greater than
maximumInclusive - the value is not a number
-
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 than
minimumInclusive - not a number
- less than
-
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 ornameare nullIllegalArgumentException- if:nameis emptynamecontains whitespacenameis already in use by the value being validated or the validator context- the value is less than
minimumInclusive - the value is not a number
-
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 to
minimumExclusive - not a number
- less than or equal to
-
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 ornameare nullIllegalArgumentException- if:nameis emptynamecontains whitespacenameis already in use by the value being validated or the validator context- the value is less or equal to
minimumExclusive - the value is not a number
-
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:minimumInclusiveis greater thanmaximumExclusive- the value is greater than or equal to
maximumExclusive - the value is not a number
-
isBetween
FloatValidator isBetween(float minimum, boolean minimumIsInclusive, float maximum, boolean maximumIsInclusive) Ensures that the value is within a range.- Parameters:
minimum- the lower bound of the rangeminimumIsInclusive-trueif the lower bound of the range is inclusivemaximum- the upper bound of the rangemaximumIsInclusive-trueif the upper bound of the range is inclusive- Returns:
- this
- Throws:
NullPointerException- if the value is nullIllegalArgumentException- if:minimumis greater thanmaximumminimumIsInclusiveistrueand the value is less thanminimumminimumIsInclusiveisfalseand the value is less than or equal tominimummaximumIsInclusiveistrueand the value is greater thanmaximummaximumInclusiveisfalseand the value is greater than or equal tomaximum- the value is not a number
-