Package org.goplanit.utils.exceptions
Class PlanItRunTimeException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- org.goplanit.utils.exceptions.PlanItRunTimeException
-
- All Implemented Interfaces:
Serializable
public class PlanItRunTimeException extends RuntimeException
General run time exception for PlanIt which wraps exceptions thrown during execution- Author:
- markr
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description PlanItRunTimeException(Exception parentException)
Constructor using Exception - wraps run-time exceptionsPlanItRunTimeException(String exceptionDescription)
Constructor using String - catches logic-driven exceptionsPlanItRunTimeException(String exceptionDescription, Object... objectArgs)
Constructor using formatted string - catches logic-driven exceptionsPlanItRunTimeException(String exceptionDescription, Throwable cause)
Constructor using Throwable - wraps run-time exceptions with additional messagePlanItRunTimeException(String exceptionDescription, Throwable cause, Object... objectArgs)
Constructor using formatted string - catches logic-driven exceptions
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
throwIf(boolean condition, String message, Object... objectArgs)
Throw a planitException if condition is metstatic void
throwIfNull(Object object, String message)
Throw a planitException if object is nullstatic void
throwIfNull(Object object, String message, Object... objectArgs)
Throw a PLANitException if object is nullstatic <T> void
throwIfNullOrEmpty(Collection<T> collection, String message, Object... objectArgs)
Throw a PLANitRunTimeException if collection is null or emptystatic void
throwNew(String message)
throw a new PLANit run time exception with a messagestatic void
throwNew(String message, Object... objectArgs)
throw a new PLANit run time exception with a message-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
Constructor Detail
-
PlanItRunTimeException
public PlanItRunTimeException(String exceptionDescription)
Constructor using String - catches logic-driven exceptions- Parameters:
exceptionDescription
- text containing description of logic error
-
PlanItRunTimeException
public PlanItRunTimeException(String exceptionDescription, Object... objectArgs)
Constructor using formatted string - catches logic-driven exceptions- Parameters:
exceptionDescription
- text containing description of logic error with formatted place holdersobjectArgs
- arguments to be added to formatted string message
-
PlanItRunTimeException
public PlanItRunTimeException(String exceptionDescription, Throwable cause, Object... objectArgs)
Constructor using formatted string - catches logic-driven exceptions- Parameters:
exceptionDescription
- text containing description of logic error with formatted place holderscause
- original exception causeobjectArgs
- arguments to be added to formatted string message
-
PlanItRunTimeException
public PlanItRunTimeException(Exception parentException)
Constructor using Exception - wraps run-time exceptions- Parameters:
parentException
- source exception
-
-
Method Detail
-
throwIf
public static void throwIf(boolean condition, String message, Object... objectArgs) throws PlanItRunTimeException
Throw a planitException if condition is met- Parameters:
condition
- when met we throwmessage
- for exceptionobjectArgs
- to format exception string with- Throws:
PlanItRunTimeException
- thrown when condition not met
-
throwIfNull
public static void throwIfNull(Object object, String message) throws PlanItRunTimeException
Throw a planitException if object is null- Parameters:
object
- to testmessage
- for exception- Throws:
PlanItRunTimeException
- thrown when condition not met
-
throwIfNull
public static void throwIfNull(Object object, String message, Object... objectArgs) throws PlanItRunTimeException
Throw a PLANitException if object is null- Parameters:
object
- to testmessage
- for exceptionobjectArgs
- to format exception string with- Throws:
PlanItRunTimeException
- thrown when condition not met
-
throwIfNullOrEmpty
public static <T> void throwIfNullOrEmpty(Collection<T> collection, String message, Object... objectArgs) throws PlanItRunTimeException
Throw a PLANitRunTimeException if collection is null or empty- Type Parameters:
T
- concrete type of collection- Parameters:
collection
- to testmessage
- for exceptionobjectArgs
- to format exception string with- Throws:
PlanItRunTimeException
- thrown when condition not met
-
throwNew
public static void throwNew(String message)
throw a new PLANit run time exception with a message- Parameters:
message
- to include
-
-