public class NotFoundException extends Exception
Constructor and Description |
---|
NotFoundException()
Creates an empty exception.
|
NotFoundException(String message)
Creates an exception with a message.
|
NotFoundException(String message,
Throwable cause)
Creates an exception with a message and a cause.
|
NotFoundException(Throwable cause)
Creates an exception with a cause.
|
Modifier and Type | Method and Description |
---|---|
static <T extends Collection<?>> |
throwWhenEmpty(T collection,
String message)
Throws the
NotFoundException when the passed collection is null or empty. |
static <T extends Collection<?>> |
throwWhenEmpty(T collection,
String message,
Object... args)
Throws the
NotFoundException when the passed collection is null or empty. |
static <T> T |
throwWhenNull(T object,
String message)
Throws the
NotFoundException when the passed object is null . |
static <T> T |
throwWhenNull(T object,
String message,
Object... args)
Throws the
NotFoundException when the passed object is null . |
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
public NotFoundException()
public NotFoundException(@Nonnull String message)
message
- the messagepublic NotFoundException(@Nonnull Throwable cause)
cause
- the cause@Nonnull public static <T> T throwWhenNull(@Nullable T object, @Nonnull String message) throws NotFoundException
NotFoundException
when the passed object is null
. The method returns the object
itself and thus it can be used with fluent interfaces.object
- the object to be testedmessage
- the error message to be thrownNotFoundException
- if the object is null@Nonnull public static <T> T throwWhenNull(@Nullable T object, @Nonnull String message, @Nonnull Object... args) throws NotFoundException
NotFoundException
when the passed object is null
. The method returns the object
itself and thus it can be used with fluent interfaces.object
- the object to be testedmessage
- the error message to be thrown (formatted as in String.format(java.lang.String, java.lang.Object...)
args
- the arguments to format the error messageNotFoundException
- if the object is null@Nonnull public static <T extends Collection<?>> T throwWhenEmpty(@Nullable T collection, @Nonnull String message) throws NotFoundException
NotFoundException
when the passed collection is null
or empty. The method returns the
collection itself and thus it can be used with fluent interfaces.collection
- the collection to be testedmessage
- the error message to be thrownNotFoundException
- if the collection is null or empty@Nonnull public static <T extends Collection<?>> T throwWhenEmpty(@Nullable T collection, @Nonnull String message, @Nonnull Object... args) throws NotFoundException
NotFoundException
when the passed collection is null
or empty. The method returns the
collection itself and thus it can be used with fluent interfaces.collection
- the collection to be testedmessage
- the error message to be thrown (formatted as in String.format(java.lang.String, java.lang.Object...)
args
- the arguments to format the error messageNotFoundException
- if the collection is null or emptyCopyright © 2009–2015 Tidalwave s.a.s. (http://tidalwave.it). All rights reserved.