Class Validation

java.lang.Object
cn.nukkit.utils.Validation

@PowerNukkitOnly @Since("1.4.0.0-PN") public final class Validation extends Object
Since:
2020-10-11
Author:
joserobjr
  • 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.