public class ThrowableUtils extends Object
| Constructor and Description |
|---|
ThrowableUtils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
assertFieldNotNull(Object fieldValue,
String fieldName)
Throws an
IllegalArgumentException if the specified field is |
static void |
assertFieldPositive(int fieldValue,
String fieldName)
Throws an
IllegalArgumentException if the specified field is |
static void |
assertNotNull(Object o,
String msg,
Object... args)
Throws an
IllegalArgumentException if the specified object is |
static void |
assertSameThread(long threadId,
String msg,
Object... args)
Throws an exception if the specified thread ID is not the same as the current thread.
|
static void |
illegalArg(String msg,
Object... args)
Shortcut for calling
|
public ThrowableUtils()
public static void assertNotNull(Object o, String msg, Object... args) throws IllegalArgumentException
IllegalArgumentException if the specified object is o - The object to check.msg - The message of the IllegalArgumentException.args - Optional MessageFormat-style arguments.IllegalArgumentException - Constructed exception.public static void assertFieldNotNull(Object fieldValue, String fieldName) throws IllegalArgumentException
IllegalArgumentException if the specified field is fieldValue - The object to check.fieldName - The name of the field.IllegalArgumentException - Constructed exception.public static void assertFieldPositive(int fieldValue, String fieldName) throws IllegalArgumentException
IllegalArgumentException if the specified field is fieldValue - The object to check.fieldName - The name of the field.IllegalArgumentException - Constructed exception.public static void illegalArg(String msg, Object... args) throws IllegalArgumentException
new IllegalArgumentException(MessageFormat.format (msg, args));msg - The message of the IllegalArgumentException.args - Optional MessageFormat-style arguments.IllegalArgumentException - Constructed exception.public static void assertSameThread(long threadId, String msg, Object... args) throws IllegalStateException
threadId - The ID of the thread to compare against.msg - The message of the IllegalStateException.args - Optional MessageFormat-style arguments.IllegalStateException - Constructed exception.Copyright © 2016–2019 The Apache Software Foundation. All rights reserved.