Class IntChecks
java.lang.Object
dev.prozilla.pine.common.util.checks.IntChecks
Utility class for performing checks on integers.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
get()
isGreaterThan
(int other) Checks that the integer is greater than another integer.isInRange
(int min, int max) Checks that the integer is in the given range.isLessThan
(int other) Checks that the integer is less than another integer.isPositive
(boolean strict) Checks that the integer is positive.
-
Constructor Details
-
IntChecks
public IntChecks(int value) -
IntChecks
-
-
Method Details
-
named
-
get
public int get() -
isPositive
Checks that the integer is positive.- Parameters:
strict
- Whether to forbid0
- Throws:
InvalidNumberException
-
isGreaterThan
Checks that the integer is greater than another integer.- Parameters:
other
- The other integer- Throws:
InvalidNumberException
- If the integer is not greater than the other integer.
-
isLessThan
Checks that the integer is less than another integer.- Parameters:
other
- The other integer- Throws:
InvalidNumberException
- If the integer is not less than the other integer.
-
isInRange
Checks that the integer is in the given range.- Parameters:
min
- Lower bound (inclusive)max
- Upper bound (inclusive)- Throws:
InvalidNumberException
-