| Constructor and Description |
|---|
Configuration(Class<? extends RuntimeException> exceptionOverride,
Map<String,Object> context)
Creates a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
<E extends RuntimeException> |
createException(Class<E> type,
String message)
Creates a new exception.
|
<E extends RuntimeException> |
createException(Class<E> type,
String message,
Map<String,Object> initialContext,
Throwable cause)
Creates a new exception.
|
<E extends RuntimeException> |
createException(Class<E> type,
String message,
String key1,
Object value1)
Creates a new exception.
|
<E extends RuntimeException> |
createException(Class<E> type,
String message,
String key1,
Object value1,
String key2,
Object value2)
Creates a new exception.
|
<E extends RuntimeException> |
createException(Class<E> type,
String message,
String key1,
Object value1,
String key2,
Object value2,
String key3,
Object value3)
Creates a new exception.
|
<E extends RuntimeException> |
createException(Class<E> type,
String message,
String key1,
Object value1,
String key2,
Object value2,
String key3,
Object value3,
String key4,
Object value4)
Creates a new exception.
|
<E extends RuntimeException> |
createException(Class<E> type,
String message,
String key1,
Object value1,
String key2,
Object value2,
String key3,
Object value3,
String key4,
Object value4,
Throwable cause)
Creates a new exception.
|
<E extends RuntimeException> |
createException(Class<E> type,
String message,
String key1,
Object value1,
String key2,
Object value2,
String key3,
Object value3,
Throwable cause)
Creates a new exception.
|
<E extends RuntimeException> |
createException(Class<E> type,
String message,
String key1,
Object value1,
String key2,
Object value2,
Throwable cause)
Creates a new exception.
|
<E extends RuntimeException> |
createException(Class<E> type,
String message,
String key1,
Object value1,
Throwable cause)
Creates a new exception.
|
<E extends RuntimeException> |
createException(Class<E> type,
String message,
Throwable cause)
Creates a new exception.
|
ImmutableMap<String,Object> |
getContext() |
Class<? extends RuntimeException> |
getExceptionOverride() |
Configuration |
withContext(Map<String,Object> context)
Supplies additional key-value pairs to output if a requirement is not met.
|
Configuration |
withException(Class<? extends RuntimeException> exception)
Overrides the type of exception that will get thrown if a requirement fails.
|
public Configuration(Class<? extends RuntimeException> exceptionOverride, Map<String,Object> context)
exceptionOverride - the type of exception to throw, null to disable the overridecontext - key-value pairs to append to the exception messagepublic Configuration withException(Class<? extends RuntimeException> exception)
exception - the type of exception to throw, null to disable the overridepublic Configuration withContext(Map<String,Object> context) throws NullPointerException
context - a map of key-value pairsNullPointerException - if context is nullpublic Class<? extends RuntimeException> getExceptionOverride()
public ImmutableMap<String,Object> getContext()
public <E extends RuntimeException> RuntimeException createException(Class<E> type, String message)
E - the type of the exceptiontype - the type of the exceptionmessage - an explanation of what went wrongNullPointerException - if type or message are nullpublic <E extends RuntimeException> RuntimeException createException(Class<E> type, String message, Throwable cause)
E - the type of the exceptiontype - the type of the exceptionmessage - an explanation of what went wrongcause - the cause of the exceptionNullPointerException - if type or message are nullpublic <E extends RuntimeException> RuntimeException createException(Class<E> type, String message, String key1, Object value1)
E - the type of the exceptiontype - the type of the exceptionmessage - an explanation of what went wrongkey1 - the first key to append to the exception messagevalue1 - the first value to append to the exception messageNullPointerException - if type, message or key1 are nullpublic <E extends RuntimeException> RuntimeException createException(Class<E> type, String message, String key1, Object value1, Throwable cause)
E - the type of the exceptiontype - the type of the exceptionmessage - an explanation of what went wrongkey1 - the first key to append to the exception messagevalue1 - the first value to append to the exception messagecause - the cause of the exceptionNullPointerException - if type, message or key1 are nullpublic <E extends RuntimeException> RuntimeException createException(Class<E> type, String message, String key1, Object value1, String key2, Object value2)
E - the type of the exceptiontype - the type of the exceptionmessage - an explanation of what went wrongkey1 - the first key to append to the exception messagevalue1 - the first value to append to the exception messagekey2 - the second key to append to the exception messagevalue2 - the second value to append to the exception messageNullPointerException - if type, message, key1 or key2 are
nullpublic <E extends RuntimeException> RuntimeException createException(Class<E> type, String message, String key1, Object value1, String key2, Object value2, Throwable cause)
E - the type of the exceptiontype - the type of the exceptionmessage - an explanation of what went wrongkey1 - the first key to append to the exception messagevalue1 - the first value to append to the exception messagekey2 - the second key to append to the exception messagevalue2 - the second value to append to the exception messagecause - the cause of the exceptionNullPointerException - if type, message, key1 or key2 are
nullpublic <E extends RuntimeException> RuntimeException createException(Class<E> type, String message, String key1, Object value1, String key2, Object value2, String key3, Object value3)
E - the type of the exceptiontype - the type of the exceptionmessage - an explanation of what went wrongkey1 - the first key to append to the exception messagevalue1 - the first value to append to the exception messagekey2 - the second key to append to the exception messagevalue2 - the second value to append to the exception messagekey3 - the third key to append to the exception messagevalue3 - the third value to append to the exception messageNullPointerException - if type, message, key1, key2 or
key3 are nullpublic <E extends RuntimeException> RuntimeException createException(Class<E> type, String message, String key1, Object value1, String key2, Object value2, String key3, Object value3, Throwable cause)
E - the type of the exceptiontype - the type of the exceptionmessage - an explanation of what went wrongkey1 - the first key to append to the exception messagevalue1 - the first value to append to the exception messagekey2 - the second key to append to the exception messagevalue2 - the second value to append to the exception messagekey3 - the third key to append to the exception messagevalue3 - the third value to append to the exception messagecause - the cause of the exceptionNullPointerException - if type, message, key1, key2 or
key3 are nullpublic <E extends RuntimeException> RuntimeException createException(Class<E> type, String message, String key1, Object value1, String key2, Object value2, String key3, Object value3, String key4, Object value4)
E - the type of the exceptiontype - the type of the exceptionmessage - an explanation of what went wrongkey1 - the first key to append to the exception messagevalue1 - the first value to append to the exception messagekey2 - the second key to append to the exception messagevalue2 - the second value to append to the exception messagekey3 - the third key to append to the exception messagevalue3 - the third value to append to the exception messagekey4 - the third key to append to the exception messagevalue4 - the third value to append to the exception messageNullPointerException - if type, message, key1, key2,
key3 or key4 are nullpublic <E extends RuntimeException> RuntimeException createException(Class<E> type, String message, String key1, Object value1, String key2, Object value2, String key3, Object value3, String key4, Object value4, Throwable cause)
E - the type of the exceptiontype - the type of the exceptionmessage - an explanation of what went wrongkey1 - the first key to append to the exception messagevalue1 - the first value to append to the exception messagekey2 - the second key to append to the exception messagevalue2 - the second value to append to the exception messagekey3 - the third key to append to the exception messagevalue3 - the third value to append to the exception messagekey4 - the third key to append to the exception messagevalue4 - the third value to append to the exception messagecause - the cause of the exceptionNullPointerException - if type, message, key1, key2,
key3 or key4 are nullpublic <E extends RuntimeException> RuntimeException createException(Class<E> type, String message, Map<String,Object> initialContext, Throwable cause)
E - the type of the exceptiontype - the type of the exceptionmessage - an explanation of what went wronginitialContext - key-value pairs to append to the exception message before the context
passed into the constructorcause - the cause of the exceptionNullPointerException - if any of the arguments are nullCopyright © 2016. All rights reserved.