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 Summary
Modifier and TypeMethodDescriptionstatic @NotNull IllegalArgumentException
alreadyExistsException
(String type, String name) Creates a newIllegalArgumentException
-instance with amessage
representing an Already Exists-exception.static @NotNull IllegalArgumentException
doesNotExistException
(String type, String name) Creates a newIllegalArgumentException
-instance with amessage
representing a Does Not Exist-exception.static @NotNull IllegalArgumentException
notMatchingRegExException
(String key, String regEx) Creates a newIllegalArgumentException
-instance with amessage
representing a Not Matching RegEx-exception.static @NotNull IllegalArgumentException
nullException
(String key) Creates a newIllegalArgumentException
-instance with amessage
representing a Null-exception.static @NotNull IllegalArgumentException
Creates a newIllegalArgumentException
-instance with amessage
representing a Null or Empty-exception.static @NotNull IllegalArgumentException
Creates a newIllegalArgumentException
-instance with amessage
representing a Reserved Java Keyword-exception.
-
Method Details
-
nullException
@NotNull @Contract("_ -> new") public static @NotNull IllegalArgumentException nullException(String key) 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 @NotNull 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
-
notMatchingRegExException
@NotNull @Contract("_, _ -> new") public static @NotNull 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 @NotNull 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 @NotNull 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 @NotNull 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
-