Class InvalidArgumentException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
ch.nolix.baseapi.errorcontrol.invalidargumentexception.AbstractInvalidArgumentException
ch.nolix.baseapi.errorcontrol.invalidargumentexception.InvalidArgumentException
- All Implemented Interfaces:
Serializable
- Author:
- Silvan Wyss
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic InvalidArgumentExceptionforArgument(Object argument) static InvalidArgumentExceptionforArgumentAndArgumentName(Object argument, String argumentName) static InvalidArgumentExceptionforArgumentAndArgumentNameAndErrorPredicate(Object argument, String argumentName, String errorPredicate) static <A> InvalidArgumentExceptionforArgumentAndArgumentType(A argument, Class<A> argumentType) static InvalidArgumentExceptionforArgumentAndErrorPredicate(Object argument, String errorPredicate) Methods inherited from class AbstractInvalidArgumentException
getArgumentName, getErrorPredicate, getStoredArgumentMethods inherited from class Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Method Details
-
forArgument
- Parameters:
argument- - Can be null- Returns:
- a new
InvalidArgumentExceptionfor the given argument.
-
forArgumentAndErrorPredicate
public static InvalidArgumentException forArgumentAndErrorPredicate(Object argument, String errorPredicate) - Parameters:
argument- - Can be nullerrorPredicate-- Returns:
- a new
InvalidArgumentExceptionfor the given argument and errorPredicate - Throws:
RuntimeException- if the given errorPredicate is null or blank or ends with a dot.
-
forArgumentAndArgumentName
public static InvalidArgumentException forArgumentAndArgumentName(Object argument, String argumentName) - Parameters:
argument- - Can be nullargumentName-- Returns:
- a new
InvalidArgumentExceptionfor the given argument and argumentName - Throws:
RuntimeException- if the given argumentName is null or blank
-
forArgumentAndArgumentNameAndErrorPredicate
public static InvalidArgumentException forArgumentAndArgumentNameAndErrorPredicate(Object argument, String argumentName, String errorPredicate) - Parameters:
argument-argumentName-errorPredicate-- Returns:
- a new
InvalidArgumentExceptionfor the given argument, argumentName and errorPredicate - Throws:
RuntimeException- if the given argumentName is null or blankRuntimeException- if the given errorPredicate is null or blank or ends with a dot.
-
forArgumentAndArgumentType
public static <A> InvalidArgumentException forArgumentAndArgumentType(A argument, Class<A> argumentType) - Type Parameters:
A- the type of the given argument- Parameters:
argument-argumentType-- Returns:
- a new @link InvalidArgumentException} for the givne argument and argumentType
- Throws:
RuntimeException- if the given arumentType is null
-