Class ExceptionFactory

java.lang.Object
io.github.chrimle.classforge.utils.ExceptionFactory

public final class ExceptionFactory extends Object
Factory-class for instantiating Exception-classes with message presets.
Since:
0.5.0
Author:
Chrimle
  • Method Details

    • nullException

      @NotNull @Contract("_ -> new") public static IllegalArgumentException nullException(String key)
      Creates a new IllegalArgumentException-instance with a message representing a Null-exception.
      Parameters:
      key - which had a null-value.
      Returns:
      the exception.
      Since:
      0.5.0
    • nullOrEmptyException

      @NotNull @Contract("_ -> new") public static IllegalArgumentException nullOrEmptyException(String key)
      Creates a new IllegalArgumentException-instance with a message representing a Null or Empty-exception.
      Parameters:
      key - which had a null or empty value.
      Returns:
      the exception.
      Since:
      0.5.0
    • lessThanZeroException

      @NotNull @Contract("_ -> new") public static IllegalArgumentException lessThanZeroException(String key)
      Creates a new IllegalArgumentException-instance with a message representing a Less Than Zero-exception.
      Parameters:
      key - which had a less than zero value.
      Returns:
      the exception.
      Since:
      0.5.0
    • notMatchingRegExException

      @NotNull @Contract("_, _ -> new") public static IllegalArgumentException notMatchingRegExException(String key, String regEx)
      Creates a new IllegalArgumentException-instance with a message representing a Not Matching RegEx-exception.
      Parameters:
      key - which had a non-matching value.
      regEx - to match.
      Returns:
      the exception.
      Since:
      0.5.0
    • alreadyExistsException

      @NotNull @Contract("_, _ -> new") public static IllegalArgumentException alreadyExistsException(String type, String name)
      Creates a new IllegalArgumentException-instance with a message representing an Already Exists-exception.
      Parameters:
      type - of the entity.
      name - of the entity.
      Returns:
      the exception.
      Since:
      0.5.0
    • doesNotExistException

      @NotNull @Contract("_, _ -> new") public static IllegalArgumentException doesNotExistException(String type, String name)
      Creates a new IllegalArgumentException-instance with a message representing a Does Not Exist-exception.
      Parameters:
      type - of the entity.
      name - of the entity.
      Returns:
      the exception.
      Since:
      0.5.0
    • reservedJavaKeywordException

      @NotNull @Contract("_ -> new") public static IllegalArgumentException reservedJavaKeywordException(String key)
      Creates a new IllegalArgumentException-instance with a message representing a Reserved Java Keyword-exception.
      Parameters:
      key - which had Reserved Java Keyword-value.
      Returns:
      the exception.
      Since:
      0.5.0