T
- the type of the error parameterpublic class ErrorParameter<T extends Exception> extends Object implements Serializable
Constructor and Description |
---|
ErrorParameter(Class<T> parameterType,
Exception caughtException)
Create ErrorParameter for exception.
|
ErrorParameter(Class<T> parameterType,
Exception caughtException,
String customMessage)
Create ErrorParameter for exception with a custom message.
|
Modifier and Type | Method and Description |
---|---|
Exception |
getCaughtException()
Gets the originally caught exception.
|
String |
getCustomMessage()
Get the set custom message.
|
T |
getException()
Get the error parameter exception.
|
boolean |
hasCustomMessage()
Check if we have a custom message for the exception.
|
public ErrorParameter(Class<T> parameterType, Exception caughtException)
parameterType
- the exception type of this error parametercaughtException
- the caught exceptionpublic ErrorParameter(Class<T> parameterType, Exception caughtException, String customMessage)
parameterType
- the exception type of this error parametercaughtException
- the caught exceptioncustomMessage
- custom message to go with exceptionpublic T getException()
getCaughtException()
if that exception is of the type of this
error parameter. Otherwise, it will be the first
Throwable.getCause()
which is of the right type.getCaughtException()
public Exception getCaughtException()
getException()
public boolean hasCustomMessage()
public String getCustomMessage()
Copyright © 2020. All rights reserved.