Class ExceptionFactory

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

@API(status=INTERNAL, since="0.6.0", consumers="io.github.chrimle.classforge") public final class ExceptionFactory extends Object
Factory-class for instantiating Exception-classes with message presets.

FOR INTERNAL USE ONLY.

Since:
0.5.0
Author:
Chrimle
  • Method Details

    • nullException

      @NotNull @Contract("_ -> new") public static @NotNull 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 @NotNull 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
    • notMatchingRegExException

      @NotNull @Contract("_, _ -> new") public static @NotNull 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 @NotNull 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 @NotNull 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 @NotNull 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