public final class Exceptions extends Object
Validate
class.Modifier and Type | Method and Description |
---|---|
static void |
illegalPluginAccess(boolean state)
|
static void |
illegalPluginAccess(boolean state,
String message)
|
static void |
illegalState(boolean state)
|
static void |
illegalState(boolean state,
String message)
|
static <T extends RuntimeException> |
isTrue(boolean validate,
Class<T> ex)
Validates a statement is
true , and throws a custom
RuntimeException as specified by the passed class parameter |
static <T extends RuntimeException> |
isTrue(boolean validate,
String message,
Class<T> ex)
Validates a statement is
true , and throws a custom
RuntimeException as specified by the passed class parameter |
static <T extends RuntimeException> |
notNull(Object obj,
Class<T> ex)
Provides a null check, and throws a custom
RuntimeException as
specified by the passed class parameter |
static <T extends RuntimeException> |
notNull(Object obj,
String message,
Class<T> ex)
Provides a null check, and throws a custom
RuntimeException as
specified by the passed class parameter |
static String |
readableStackTrace(Throwable t)
Creates a readable stack trace from a passed
Throwable . |
static void |
unsupportedOperation(boolean state)
|
static void |
unsupportedOperation(boolean state,
String message)
|
public static void illegalState(boolean state, String message)
state
- The conditional to verifymessage
- The message to include in an IllegalStateException
IllegalStateException
- if state
is false
public static void illegalState(boolean state)
state
- The conditional to verifyIllegalStateException
- if state
is false
public static void illegalPluginAccess(boolean state, String message)
state
- The conditional to verifymessage
- The message to include in an
IllegalPluginAccessException
IllegalPluginAccessException
- if state
is false
public static void illegalPluginAccess(boolean state)
state
- The conditional to verifyIllegalPluginAccessException
- if state
is false
public static void unsupportedOperation(boolean state, String message)
state
- The conditional to verifymessage
- The message to include in an
UnsupportedOperationException
UnsupportedOperationException
- if state
is false
public static void unsupportedOperation(boolean state)
state
- The conditional to verifyUnsupportedOperationException
- if state
is false
public static <T extends RuntimeException> void notNull(Object obj, String message, Class<T> ex)
RuntimeException
as
specified by the passed class parameterT
- The exception typeobj
- The object to check for null
message
- The message to add to the exception if obj
is nullex
- The RuntimeException
class to instantiatepublic static <T extends RuntimeException> void notNull(Object obj, Class<T> ex)
RuntimeException
as
specified by the passed class parameterT
- The exception typeobj
- The object to check for null
ex
- The RuntimeException
class to instantiatepublic static <T extends RuntimeException> void isTrue(boolean validate, String message, Class<T> ex)
true
, and throws a custom
RuntimeException
as specified by the passed class parameterT
- The exception typevalidate
- The boolean
to evaluatemessage
- The message to add to the exception if obj
is nullex
- The RuntimeException
class to instantiatepublic static <T extends RuntimeException> void isTrue(boolean validate, Class<T> ex)
true
, and throws a custom
RuntimeException
as specified by the passed class parameterT
- The exception typevalidate
- The boolean
to evaluateex
- The RuntimeException
class to instantiatepublic static String readableStackTrace(Throwable t)
Throwable
. This
method will reproduce the same output that
Throwable.printStackTrace()
would outputt
- The Throwable
to make readableCopyright © 2015. All rights reserved.