Package pcap.common.util
Class ValidateNumber
java.lang.Object
pcap.common.util.ValidateNumber
@Inclubating public final class ValidateNumber extends Object
- Author:
- Ardika Rommy Sanjaya
-
Constructor Summary
Constructors Constructor Description ValidateNumber()
-
Method Summary
Modifier and Type Method Description static <T extends Number>
intcompare(T number)
Compares thisT
with the specifiedT
static <T extends Number>
voidnotGreaterThenOrEqualZero(T number)
Ensures that given parameter is greateer then zero.static <T extends Number>
voidnotGreaterThenOrEqualZero(T number, String message)
Ensures that given parameter is greateer then zero.static <T extends Number>
voidnotGreaterThenZero(T number)
Ensures that given parameter is greateer then zero.static <T extends Number>
voidnotGreaterThenZero(T number, String message)
Ensures that given parameter is greateer then zero.static <T extends Number>
voidnotLessThenOrEqualZero(T number)
Ensures that given parameter is less then zero.static <T extends Number>
voidnotLessThenOrEqualZero(T number, String message)
Ensures that given parameter is less then zero.static <T extends Number>
voidnotLessThenZero(T number)
Ensures that given parameter is less then zero.static <T extends Number>
voidnotLessThenZero(T number, String message)
Ensures that given parameter is less then zero.static void
notNumeric(String text)
static void
notNumeric(String text, String message)
Ensures that given parameter is not contains non numeric character.static void
notNumericWithCommaSeparator(String text)
Ensures that given parameter is not contains non numeric and comma separator.static void
notNumericWithDotAndCommaSeparator(String text)
Ensures that given parameter is not contains non numeric, dot and comma separator.static void
notNumericWithDotSeparator(String text)
Ensures that given parameter is not contains non numeric character and dot separator.static <T extends Number>
voidnotZero(T number)
Ensures that given parameter is zero.static <T extends Number>
voidnotZero(T number, String message)
Ensures that given parameter is zero.
-
Constructor Details
-
ValidateNumber
public ValidateNumber()
-
-
Method Details
-
notNumeric
- Throws:
IllegalArgumentException
-
notNumericWithCommaSeparator
Ensures that given parameter is not contains non numeric and comma separator.- Parameters:
text
- text.- Throws:
IllegalArgumentException
- illegal argument exception.
-
notNumericWithDotAndCommaSeparator
Ensures that given parameter is not contains non numeric, dot and comma separator.- Parameters:
text
- text.- Throws:
IllegalArgumentException
- illegal argument exception.
-
notNumericWithDotSeparator
Ensures that given parameter is not contains non numeric character and dot separator.- Parameters:
text
- text.- Throws:
IllegalArgumentException
- illegal argument exception.
-
notNumeric
Ensures that given parameter is not contains non numeric character.- Parameters:
text
- test.message
- exception.- Throws:
IllegalArgumentException
- illegal argument exception.
-
notZero
Ensures that given parameter is zero.- Type Parameters:
T
- type.- Parameters:
number
- number.- Throws:
IllegalArgumentException
- exception.
-
notZero
public static <T extends Number> void notZero(T number, String message) throws IllegalArgumentExceptionEnsures that given parameter is zero.- Type Parameters:
T
- type.- Parameters:
number
- number.message
- exception.- Throws:
IllegalArgumentException
- illegal argument exception.
-
notGreaterThenZero
Ensures that given parameter is greateer then zero.- Type Parameters:
T
- type.- Parameters:
number
- number.- Throws:
IllegalArgumentException
- exception.
-
notGreaterThenZero
public static <T extends Number> void notGreaterThenZero(T number, String message) throws IllegalArgumentExceptionEnsures that given parameter is greateer then zero.- Type Parameters:
T
- type.- Parameters:
number
- number.message
- illegal argument exception.- Throws:
IllegalArgumentException
- exception.
-
notLessThenZero
Ensures that given parameter is less then zero.- Type Parameters:
T
- type.- Parameters:
number
- number.- Throws:
IllegalArgumentException
- exception.
-
notLessThenZero
public static <T extends Number> void notLessThenZero(T number, String message) throws IllegalArgumentExceptionEnsures that given parameter is less then zero.- Type Parameters:
T
- type.- Parameters:
number
- number.message
- illegal argument exception.- Throws:
IllegalArgumentException
- exception.
-
notGreaterThenOrEqualZero
public static <T extends Number> void notGreaterThenOrEqualZero(T number) throws IllegalArgumentExceptionEnsures that given parameter is greateer then zero.- Type Parameters:
T
- type.- Parameters:
number
- number.- Throws:
IllegalArgumentException
- exception.
-
notGreaterThenOrEqualZero
public static <T extends Number> void notGreaterThenOrEqualZero(T number, String message) throws IllegalArgumentExceptionEnsures that given parameter is greateer then zero.- Type Parameters:
T
- type.- Parameters:
number
- number.message
- illegal argument exception.- Throws:
IllegalArgumentException
- exception.
-
notLessThenOrEqualZero
public static <T extends Number> void notLessThenOrEqualZero(T number) throws IllegalArgumentExceptionEnsures that given parameter is less then zero.- Type Parameters:
T
- type.- Parameters:
number
- number.- Throws:
IllegalArgumentException
- exception.
-
notLessThenOrEqualZero
public static <T extends Number> void notLessThenOrEqualZero(T number, String message) throws IllegalArgumentExceptionEnsures that given parameter is less then zero.- Type Parameters:
T
- type.- Parameters:
number
- number.message
- illegal argument exception.- Throws:
IllegalArgumentException
- exception.
-
compare
Compares thisT
with the specifiedT
- Type Parameters:
T
- type.- Parameters:
number
-T
to which thisT
is to be compared.- Returns:
- -1, 0, or 1 as this
T
is numerically less than, equal to, or greater thannuber
. - Throws:
IllegalArgumentException
-