Class ExceptionFactory
java.lang.Object
io.github.chrimle.classforge.utils.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 Summary
Modifier and TypeMethodDescriptionstatic IllegalArgumentExceptionalreadyExistsException(String type, String name) Creates a newIllegalArgumentException-instance with amessagerepresenting an Already Exists-exception.static IllegalArgumentExceptiondoesNotExistException(String type, String name) Creates a newIllegalArgumentException-instance with amessagerepresenting a Does Not Exist-exception.static IllegalArgumentExceptionCreates a newIllegalArgumentException-instance with amessagerepresenting a Less Than Zero-exception.static IllegalArgumentExceptionnotMatchingRegExException(String key, String regEx) Creates a newIllegalArgumentException-instance with amessagerepresenting a Not Matching RegEx-exception.static IllegalArgumentExceptionnullException(String key) Creates a newIllegalArgumentException-instance with amessagerepresenting a Null-exception.static IllegalArgumentExceptionCreates a newIllegalArgumentException-instance with amessagerepresenting a Null or Empty-exception.static IllegalArgumentExceptionCreates a newIllegalArgumentException-instance with amessagerepresenting a Reserved Java Keyword-exception.
-
Method Details
-
nullException
Creates a newIllegalArgumentException-instance with amessagerepresenting a Null-exception.- Parameters:
key- which had anull-value.- Returns:
- the exception.
- Since:
- 0.5.0
-
nullOrEmptyException
@NotNull @Contract("_ -> new") public static IllegalArgumentException nullOrEmptyException(String key) Creates a newIllegalArgumentException-instance with amessagerepresenting 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 newIllegalArgumentException-instance with amessagerepresenting 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 newIllegalArgumentException-instance with amessagerepresenting 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 newIllegalArgumentException-instance with amessagerepresenting 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 newIllegalArgumentException-instance with amessagerepresenting 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 newIllegalArgumentException-instance with amessagerepresenting a Reserved Java Keyword-exception.- Parameters:
key- which had Reserved Java Keyword-value.- Returns:
- the exception.
- Since:
- 0.5.0
-