Class ExceptionFactory
java.lang.Object
io.github.chrimle.classforge.utils.ExceptionFactory
Factory-class for instantiating
Exception
-classes with message presets.- Since:
- 0.5.0
- Author:
- Chrimle
-
Method Summary
Modifier and TypeMethodDescriptionstatic IllegalArgumentException
alreadyExistsException
(String type, String name) Creates a newIllegalArgumentException
-instance with amessage
representing an Already Exists-exception.static IllegalArgumentException
doesNotExistException
(String type, String name) Creates a newIllegalArgumentException
-instance with amessage
representing a Does Not Exist-exception.static IllegalArgumentException
Creates a newIllegalArgumentException
-instance with amessage
representing a Less Than Zero-exception.static IllegalArgumentException
notMatchingRegExException
(String key, String regEx) Creates a newIllegalArgumentException
-instance with amessage
representing a Not Matching RegEx-exception.static IllegalArgumentException
nullException
(String key) Creates a newIllegalArgumentException
-instance with amessage
representing a Null-exception.static IllegalArgumentException
Creates a newIllegalArgumentException
-instance with amessage
representing a Null or Empty-exception.static IllegalArgumentException
Creates a newIllegalArgumentException
-instance with amessage
representing a Reserved Java Keyword-exception.
-
Method Details
-
nullException
Creates a newIllegalArgumentException
-instance with amessage
representing 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 amessage
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 newIllegalArgumentException
-instance with amessage
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 newIllegalArgumentException
-instance with amessage
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 newIllegalArgumentException
-instance with amessage
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 newIllegalArgumentException
-instance with amessage
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 newIllegalArgumentException
-instance with amessage
representing a Reserved Java Keyword-exception.- Parameters:
key
- which had Reserved Java Keyword-value.- Returns:
- the exception.
- Since:
- 0.5.0
-