Class 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 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 holders
        objectArgs - 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 holders
        cause - original exception cause
        objectArgs - arguments to be added to formatted string message
      • PlanItRunTimeException

        public PlanItRunTimeException​(Exception parentException)
        Constructor using Exception - wraps run-time exceptions
        Parameters:
        parentException - source exception
      • PlanItRunTimeException

        public PlanItRunTimeException​(String exceptionDescription,
                                      Throwable cause)
        Constructor using Throwable - wraps run-time exceptions with additional message
        Parameters:
        exceptionDescription - message
        cause - original exception cause
    • 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 throw
        message - for exception
        objectArgs - to format exception string with
        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 test
        message - for exception
        objectArgs - 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 test
        message - for exception
        objectArgs - 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
      • throwNew

        public static void throwNew​(String message,
                                    Object... objectArgs)
        throw a new PLANit run time exception with a message
        Parameters:
        message - to include
        objectArgs - to format exception string with