public abstract class RuntimeExceptionFactory extends Object
RuntimeExceptionFactory
class is a factory for creating common RuntimeExceptions
with the added convenience of message formatting and optional causes
.RuntimeException
Modifier and Type | Field and Description |
---|---|
static String |
NOT_IMPLEMENTED |
static String |
NOT_SUPPORTED |
Constructor and Description |
---|
RuntimeExceptionFactory() |
Modifier and Type | Method and Description |
---|---|
protected static String |
format(String message,
Object... args)
|
static IllegalArgumentException |
newIllegalArgumentException(String message,
Object... args)
Constructs and initializes an
IllegalArgumentException with the given message
and arguments used to format the message. |
static IllegalArgumentException |
newIllegalArgumentException(Throwable cause,
String message,
Object... args)
Constructs and initializes an
IllegalArgumentException with the given cause ,
message and arguments used to format the message. |
static IllegalStateException |
newIllegalStateException(String message,
Object... args)
Constructs and initializes an
IllegalStateException with the given message
and arguments used to format the message. |
static IllegalStateException |
newIllegalStateException(Throwable cause,
String message,
Object... args)
Constructs and initializes an
IllegalStateException with the given cause ,
message and arguments used to format the message. |
static RuntimeException |
newRuntimeException(String message,
Object... args)
Constructs and initializes an
RuntimeException with the given message
and arguments used to format the message. |
static RuntimeException |
newRuntimeException(Throwable cause,
String message,
Object... args)
Constructs and initializes an
RuntimeException with the given cause ,
message and arguments used to format the message. |
static UnsupportedOperationException |
newUnsupportedOperationException(String message,
Object... args)
Constructs and initializes an
UnsupportedOperationException with the given message
and arguments used to format the message. |
static UnsupportedOperationException |
newUnsupportedOperationException(Throwable cause,
String message,
Object... args)
Constructs and initializes an
UnsupportedOperationException with the given cause ,
message and arguments used to format the message. |
public static final String NOT_IMPLEMENTED
public static final String NOT_SUPPORTED
public static IllegalArgumentException newIllegalArgumentException(String message, Object... args)
IllegalArgumentException
with the given message
and arguments
used to format the message.message
- String
describing the exception
.args
- arguments
used to replace format placeholders in the message
.IllegalArgumentException
with the given message
.newIllegalArgumentException(Throwable, String, Object...)
,
IllegalArgumentException
public static IllegalArgumentException newIllegalArgumentException(Throwable cause, String message, Object... args)
IllegalArgumentException
with the given cause
,
message
and arguments
used to format the message.cause
- Throwable
identifying the reason the IllegalArgumentException
was thrown.message
- String
describing the exception
.args
- arguments
used to replace format placeholders in the message
.IllegalArgumentException
with the given cause
and message
.IllegalArgumentException
public static IllegalStateException newIllegalStateException(String message, Object... args)
IllegalStateException
with the given message
and arguments
used to format the message.message
- String
describing the exception
.args
- arguments
used to replace format placeholders in the message
.IllegalStateException
with the given message
.newIllegalStateException(Throwable, String, Object...)
,
IllegalStateException
public static IllegalStateException newIllegalStateException(Throwable cause, String message, Object... args)
IllegalStateException
with the given cause
,
message
and arguments
used to format the message.cause
- Throwable
identifying the reason the IllegalStateException
was thrown.message
- String
describing the exception
.args
- arguments
used to replace format placeholders in the message
.IllegalStateException
with the given cause
and message
.IllegalStateException
public static RuntimeException newRuntimeException(String message, Object... args)
RuntimeException
with the given message
and arguments
used to format the message.message
- String
describing the exception
.args
- arguments
used to replace format placeholders in the message
.RuntimeException
with the given message
.newRuntimeException(Throwable, String, Object...)
,
RuntimeException
public static RuntimeException newRuntimeException(Throwable cause, String message, Object... args)
RuntimeException
with the given cause
,
message
and arguments
used to format the message.cause
- Throwable
identifying the reason the RuntimeException
was thrown.message
- String
describing the exception
.args
- arguments
used to replace format placeholders in the message
.RuntimeException
with the given cause
and message
.RuntimeException
public static UnsupportedOperationException newUnsupportedOperationException(String message, Object... args)
UnsupportedOperationException
with the given message
and arguments
used to format the message.message
- String
describing the exception
.args
- arguments
used to replace format placeholders in the message
UnsupportedOperationException
with the given message
.newUnsupportedOperationException(Throwable, String, Object...)
,
UnsupportedOperationException
public static UnsupportedOperationException newUnsupportedOperationException(Throwable cause, String message, Object... args)
UnsupportedOperationException
with the given cause
,
message
and arguments
used to format the message.cause
- Throwable
identifying the reason the UnsupportedOperationException
was thrown.message
- String
describing the exception
.args
- arguments
used to replace format placeholders in the message
.UnsupportedOperationException
with the given cause
and message
.UnsupportedOperationException
protected static String format(String message, Object... args)
message
- String
containing the message pattern to format.args
- arguments
used in the message to replace format placeholders.message
.String.format(String, Object...)
,
MessageFormat.format(String, Object...)
Copyright © 2011–2019 Pivotal Software, Inc.. All rights reserved.