All Known Subinterfaces:
JavaValidators

public interface JavaRequireThat
Creates validators for the Java API that throw exceptions immediately on validation failure.
  • Method Details

    • requireThat

      PrimitiveByteValidator requireThat(byte value, String name)
      Validates the state of a byte.

      The returned validator throws an exception immediately if a validation fails.

      Parameters:
      value - the value
      name - the name of the value
      Returns:
      a validator for the value
      Throws:
      NullPointerException - if name is null
      IllegalArgumentException - if name contains whitespace, or is empty
    • requireThat

      ByteValidator requireThat(Byte value, String name)
      Validates the state of a Byte.

      The returned validator throws an exception immediately if a validation fails.

      Parameters:
      value - the value
      name - the name of the value
      Returns:
      a validator for the value
      Throws:
      NullPointerException - if name is null
      IllegalArgumentException - if name contains whitespace, or is empty
    • requireThat

      PrimitiveShortValidator requireThat(short value, String name)
      Validates the state of a short.

      The returned validator throws an exception immediately if a validation fails.

      Parameters:
      value - the value
      name - the name of the value
      Returns:
      a validator for the value
      Throws:
      NullPointerException - if name is null
      IllegalArgumentException - if name contains whitespace, or is empty
    • requireThat

      ShortValidator requireThat(Short value, String name)
      Validates the state of a Short.

      The returned validator throws an exception immediately if a validation fails.

      Parameters:
      value - the value
      name - the name of the value
      Returns:
      a validator for the value
      Throws:
      NullPointerException - if name is null
      IllegalArgumentException - if name contains whitespace, or is empty
    • requireThat

      PrimitiveIntegerValidator requireThat(int value, String name)
      Validates the state of an int.

      The returned validator throws an exception immediately if a validation fails.

      Parameters:
      value - the value
      name - the name of the value
      Returns:
      a validator for the value
      Throws:
      NullPointerException - if name is null
      IllegalArgumentException - if name contains whitespace, or is empty
    • requireThat

      IntegerValidator requireThat(Integer value, String name)
      Validates the state of an Integer.

      The returned validator throws an exception immediately if a validation fails.

      Parameters:
      value - the value
      name - the name of the value
      Returns:
      a validator for the value
      Throws:
      NullPointerException - if name is null
      IllegalArgumentException - if name contains whitespace, or is empty
    • requireThat

      PrimitiveLongValidator requireThat(long value, String name)
      Validates the state of a long.

      The returned validator throws an exception immediately if a validation fails.

      Parameters:
      value - the value
      name - the name of the value
      Returns:
      a validator for the value
      Throws:
      NullPointerException - if name is null
      IllegalArgumentException - if name contains whitespace, or is empty
    • requireThat

      LongValidator requireThat(Long value, String name)
      Validates the state of a Long.

      The returned validator throws an exception immediately if a validation fails.

      Parameters:
      value - the value
      name - the name of the value
      Returns:
      a validator for the value
      Throws:
      NullPointerException - if name is null
      IllegalArgumentException - if name contains whitespace, or is empty
    • requireThat

      PrimitiveFloatValidator requireThat(float value, String name)
      Validates the state of a float.

      The returned validator throws an exception immediately if a validation fails.

      Parameters:
      value - the value
      name - the name of the value
      Returns:
      a validator for the value
      Throws:
      NullPointerException - if name is null
      IllegalArgumentException - if name contains whitespace, or is empty
    • requireThat

      FloatValidator requireThat(Float value, String name)
      Validates the state of a Float.

      The returned validator throws an exception immediately if a validation fails.

      Parameters:
      value - the value
      name - the name of the value
      Returns:
      a validator for the value
      Throws:
      NullPointerException - if name is null
      IllegalArgumentException - if name contains whitespace, or is empty
    • requireThat

      PrimitiveDoubleValidator requireThat(double value, String name)
      Validates the state of a double.

      The returned validator throws an exception immediately if a validation fails.

      Parameters:
      value - the value
      name - the name of the value
      Returns:
      a validator for the value
      Throws:
      NullPointerException - if name is null
      IllegalArgumentException - if name contains whitespace, or is empty
    • requireThat

      DoubleValidator requireThat(Double value, String name)
      Validates the state of a Double.

      The returned validator throws an exception immediately if a validation fails.

      Parameters:
      value - the value
      name - the name of the value
      Returns:
      a validator for the value
      Throws:
      NullPointerException - if name is null
      IllegalArgumentException - if name contains whitespace or is empty
    • requireThat

      PrimitiveBooleanValidator requireThat(boolean value, String name)
      Validates the state of a boolean.

      The returned validator throws an exception immediately if a validation fails.

      Parameters:
      value - the value
      name - the name of the value
      Returns:
      a validator for the value
      Throws:
      NullPointerException - if name is null
      IllegalArgumentException - if name contains whitespace or is empty
    • requireThat

      BooleanValidator requireThat(Boolean value, String name)
      Validates the state of a Boolean.

      The returned validator throws an exception immediately if a validation fails.

      Parameters:
      value - the value
      name - the name of the value
      Returns:
      a validator for the value
      Throws:
      NullPointerException - if name is null
      IllegalArgumentException - if name contains whitespace or is empty
    • requireThat

      PrimitiveCharacterValidator requireThat(char value, String name)
      Validates the state of a char.

      The returned validator throws an exception immediately if a validation fails.

      Parameters:
      value - the value
      name - the name of the value
      Returns:
      a validator for the value
      Throws:
      NullPointerException - if name is null
      IllegalArgumentException - if name contains whitespace or is empty
    • requireThat

      CharacterValidator requireThat(Character value, String name)
      Validates the state of a Character.

      The returned validator throws an exception immediately if a validation fails.

      Parameters:
      value - the value
      name - the name of the value
      Returns:
      a validator for the value
      Throws:
      NullPointerException - if name is null
      IllegalArgumentException - if name contains whitespace or is empty
    • requireThat

      BigIntegerValidator requireThat(BigInteger value, String name)
      Validates the state of a BigInteger.

      The returned validator throws an exception immediately if a validation fails.

      Parameters:
      value - the value
      name - the name of the value
      Returns:
      a validator for the value
      Throws:
      NullPointerException - if name is null
      IllegalArgumentException - if name contains whitespace or is empty
    • requireThat

      BigDecimalValidator requireThat(BigDecimal value, String name)
      Validates the state of a BigDecimal.

      The returned validator throws an exception immediately if a validation fails.

      Parameters:
      value - the value
      name - the name of the value
      Returns:
      a validator for the value
      Throws:
      NullPointerException - if name is null
      IllegalArgumentException - if name contains whitespace or is empty
    • requireThat

      <T extends Comparable<T>> ComparableValidator<T> requireThat(T value, String name)
      Validates the state of a Comparable object.

      The returned validator throws an exception immediately if a validation fails.

      Type Parameters:
      T - the type of the value
      Parameters:
      value - the value
      name - the name of the value
      Returns:
      a validator for the value
      Throws:
      NullPointerException - if name is null
      IllegalArgumentException - if name contains whitespace or is empty
    • requireThat

      <T> ObjectValidator<T> requireThat(T value, String name)
      Validates the state of an Object.

      The returned validator throws an exception immediately if a validation fails.

      Type Parameters:
      T - the type of the value
      Parameters:
      value - the value
      name - the name of the value
      Returns:
      a validator for the value
      Throws:
      NullPointerException - if name is null
      IllegalArgumentException - if name contains whitespace or is empty
    • requireThat

      <T extends Collection<E>, E> CollectionValidator<T,E> requireThat(T value, String name)
      Validates the state of a Collection.

      The returned validator throws an exception immediately if a validation fails.

      Type Parameters:
      T - the type of the value
      E - the type of elements in the collection
      Parameters:
      value - the value
      name - the name of the value
      Returns:
      a validator for the value
      Throws:
      NullPointerException - if name is null
      IllegalArgumentException - if name contains whitespace or is empty
    • requireThat

      <T extends List<E>, E> ListValidator<T,E> requireThat(T value, String name)
      Validates the state of a List.

      The returned validator throws an exception immediately if a validation fails.

      Type Parameters:
      T - the type of the value
      E - the type of elements in the list
      Parameters:
      value - the value
      name - the name of the value
      Returns:
      a validator for the value
      Throws:
      NullPointerException - if name is null
      IllegalArgumentException - if name contains whitespace or is empty
    • requireThat

      PrimitiveByteArrayValidator requireThat(byte[] value, String name)
      Validates the state of a primitive byte array.

      The returned validator throws an exception immediately if a validation fails.

      Parameters:
      value - the value
      name - the name of the value
      Returns:
      a validator for the value
      Throws:
      NullPointerException - if name is null
      IllegalArgumentException - if name contains whitespace or is empty
    • requireThat

      PrimitiveShortArrayValidator requireThat(short[] value, String name)
      Validates the state of a primitive short array.

      The returned validator throws an exception immediately if a validation fails.

      Parameters:
      value - the value
      name - the name of the value
      Returns:
      a validator for the value
      Throws:
      NullPointerException - if name is null
      IllegalArgumentException - if name contains whitespace or is empty
    • requireThat

      PrimitiveIntegerArrayValidator requireThat(int[] value, String name)
      Validates the state of a primitive int array.

      The returned validator throws an exception immediately if a validation fails.

      Parameters:
      value - the value
      name - the name of the value
      Returns:
      a validator for the value
      Throws:
      NullPointerException - if name is null
      IllegalArgumentException - if name contains whitespace or is empty
    • requireThat

      PrimitiveLongArrayValidator requireThat(long[] value, String name)
      Validates the state of a primitive long array.

      The returned validator throws an exception immediately if a validation fails.

      Parameters:
      value - the value
      name - the name of the value
      Returns:
      a validator for the value
      Throws:
      NullPointerException - if name is null
      IllegalArgumentException - if name contains whitespace or is empty
    • requireThat

      PrimitiveFloatArrayValidator requireThat(float[] value, String name)
      Validates the state of a primitive float array.

      The returned validator throws an exception immediately if a validation fails.

      Parameters:
      value - the value
      name - the name of the value
      Returns:
      a validator for the value
      Throws:
      NullPointerException - if name is null
      IllegalArgumentException - if name contains whitespace or is empty
    • requireThat

      PrimitiveDoubleArrayValidator requireThat(double[] value, String name)
      Validates the state of a primitive double array.

      The returned validator throws an exception immediately if a validation fails.

      Parameters:
      value - the value
      name - the name of the value
      Returns:
      a validator for the value
      Throws:
      NullPointerException - if name is null
      IllegalArgumentException - if name contains whitespace or is empty
    • requireThat

      PrimitiveBooleanArrayValidator requireThat(boolean[] value, String name)
      Validates the state of a primitive boolean array.

      The returned validator throws an exception immediately if a validation fails.

      Parameters:
      value - the value
      name - the name of the value
      Returns:
      a validator for the value
      Throws:
      NullPointerException - if name is null
      IllegalArgumentException - if name contains whitespace or is empty
    • requireThat

      PrimitiveCharacterArrayValidator requireThat(char[] value, String name)
      Validates the state of a primitive char array.

      The returned validator throws an exception immediately if a validation fails.

      Parameters:
      value - the value
      name - the name of the value
      Returns:
      a validator for the value
      Throws:
      NullPointerException - if name is null
      IllegalArgumentException - if name contains whitespace or is empty
    • requireThat

      <E> ObjectArrayValidator<E[],E> requireThat(E[] value, String name)
      Validates the state of an Object array.

      The returned validator throws an exception immediately if a validation fails.

      Type Parameters:
      E - the type of elements in the array
      Parameters:
      value - the value
      name - the name of the value
      Returns:
      a validator for the value
      Throws:
      NullPointerException - if name is null
      IllegalArgumentException - if name contains whitespace or is empty
    • requireThat

      <T extends Map<K, V>, K, V> MapValidator<T,K,V> requireThat(T value, String name)
      Validates the state of a Map.

      The returned validator throws an exception immediately if a validation fails.

      Type Parameters:
      T - the type of the map
      K - the type of keys in the map
      V - the type of values in the map
      Parameters:
      value - the value
      name - the name of the value
      Returns:
      a validator for the value
      Throws:
      NullPointerException - if name is null
      IllegalArgumentException - if name contains whitespace or is empty
    • requireThat

      PathValidator requireThat(Path value, String name)
      Validates the state of a Path.

      The returned validator throws an exception immediately if a validation fails.

      Parameters:
      value - the value
      name - the name of the value
      Returns:
      a validator for the value
      Throws:
      NullPointerException - if name is null
      IllegalArgumentException - if name contains whitespace or is empty
    • requireThat

      StringValidator requireThat(String value, String name)
      Validates the state of a String.

      The returned validator throws an exception immediately if a validation fails.

      Parameters:
      value - the value
      name - the name of the value
      Returns:
      a validator for the value
      Throws:
      NullPointerException - if name is null
      IllegalArgumentException - if name contains whitespace or is empty
    • requireThat

      UriValidator requireThat(URI value, String name)
      Validates the state of a URI.

      The returned validator throws an exception immediately if a validation fails.

      Parameters:
      value - the value
      name - the name of the value
      Returns:
      a validator for the value
      Throws:
      NullPointerException - if name is null
      IllegalArgumentException - if name contains whitespace or is empty
    • requireThat

      <T> GenericTypeValidator<T> requireThat(Class<T> value, String name)
      Validates the state of a Class.

      The returned validator throws an exception immediately if a validation fails.

      Type Parameters:
      T - the type of the class modelled by the Class object. For types that contain type-parameters, use the TypeToken overload.
      Parameters:
      value - the value
      name - the name of the value
      Returns:
      a validator for the value
      Throws:
      NullPointerException - if name is null
      IllegalArgumentException - if name contains whitespace or is empty
    • requireThat

      <T> GenericTypeValidator<T> requireThat(GenericType<T> value, String name)
      Validates the state of a Class.

      The returned validator throws an exception immediately if a validation fails.

      Type Parameters:
      T - the type of the class modelled by the Class object. For types without type-parameters, prefer the Class overload.
      Parameters:
      value - the value
      name - the name of the value
      Returns:
      a validator for the value
      Throws:
      NullPointerException - if name is null
      IllegalArgumentException - if name contains whitespace or is empty
    • requireThat

      <T> OptionalValidator<T> requireThat(Optional<T> value, String name)
      Validates the state of an Optional.

      The returned validator throws an exception immediately if a validation fails.

      Type Parameters:
      T - the type of optional
      Parameters:
      value - the value
      name - the name of the value
      Returns:
      a validator for the value
      Throws:
      NullPointerException - if name is null
      IllegalArgumentException - if name contains whitespace or is empty
    • requireThat

      InetAddressValidator requireThat(InetAddress value, String name)
      Validates the state of an InetAddress.

      The returned validator throws an exception immediately if a validation fails.

      Parameters:
      value - the value
      name - the name of the value
      Returns:
      a validator for the value
      Throws:
      NullPointerException - if name is null
      IllegalArgumentException - if name contains whitespace or is empty