Package cn.nukkit.utils
Class Validation
java.lang.Object
cn.nukkit.utils.Validation
- Since:
- 2020-10-11
- Author:
- joserobjr
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
checkPositive
(String arg, byte value) Throws an exception if the value is negative.static void
checkPositive
(String arg, double value) Throws an exception if the value is negative.static void
checkPositive
(String arg, float value) Throws an exception if the value is negative.static void
checkPositive
(String arg, int value) Throws an exception if the value is negative.static void
checkPositive
(String arg, long value) Throws an exception if the value is negative.static void
checkPositive
(String arg, short value) Throws an exception if the value is negative.static void
checkPositive
(String arg, BigDecimal value) Throws an exception if the value is negative.static void
checkPositive
(String arg, BigInteger value) Throws an exception if the value is negative.
-
Method Details
-
checkPositive
@PowerNukkitOnly @Since("1.4.0.0-PN") public static void checkPositive(@Nullable String arg, byte value) Throws an exception if the value is negative.- Parameters:
arg
- The name of the argument, will be placed in front of the exception message if the value is is not null.value
- The argument value to be validated.- Throws:
IllegalArgumentException
- If the value is negative.
-
checkPositive
@PowerNukkitOnly @Since("1.4.0.0-PN") public static void checkPositive(@Nullable String arg, short value) Throws an exception if the value is negative.- Parameters:
arg
- The name of the argument, will be placed in front of the exception message if the value is is not null.value
- The argument value to be validated.- Throws:
IllegalArgumentException
- If the value is negative.
-
checkPositive
@PowerNukkitOnly @Since("1.4.0.0-PN") public static void checkPositive(@Nullable String arg, int value) Throws an exception if the value is negative.- Parameters:
arg
- The name of the argument, will be placed in front of the exception message if the value is is not null.value
- The argument value to be validated.- Throws:
IllegalArgumentException
- If the value is negative.
-
checkPositive
@PowerNukkitOnly @Since("1.4.0.0-PN") public static void checkPositive(@Nullable String arg, long value) Throws an exception if the value is negative.- Parameters:
arg
- The name of the argument, will be placed in front of the exception message if the value is is not null.value
- The argument value to be validated.- Throws:
IllegalArgumentException
- If the value is negative.
-
checkPositive
@PowerNukkitOnly @Since("1.4.0.0-PN") public static void checkPositive(@Nullable String arg, float value) Throws an exception if the value is negative.- Parameters:
arg
- The name of the argument, will be placed in front of the exception message if the value is is not null.value
- The argument value to be validated.- Throws:
IllegalArgumentException
- If the value is negative.
-
checkPositive
@PowerNukkitOnly @Since("1.4.0.0-PN") public static void checkPositive(@Nullable String arg, double value) Throws an exception if the value is negative.- Parameters:
arg
- The name of the argument, will be placed in front of the exception message if the value is is not null.value
- The argument value to be validated.- Throws:
IllegalArgumentException
- If the value is negative.
-
checkPositive
@PowerNukkitOnly @Since("1.4.0.0-PN") public static void checkPositive(@Nullable String arg, BigInteger value) Throws an exception if the value is negative.- Parameters:
arg
- The name of the argument, will be placed in front of the exception message if the value is is not null.value
- The argument value to be validated.- Throws:
IllegalArgumentException
- If the value is negative.
-
checkPositive
@PowerNukkitOnly @Since("1.4.0.0-PN") public static void checkPositive(@Nullable String arg, BigDecimal value) Throws an exception if the value is negative.- Parameters:
arg
- The name of the argument, will be placed in front of the exception message if the value is is not null.value
- The argument value to be validated.- Throws:
IllegalArgumentException
- If the value is negative.
-