Class ExceptionUtils


  • public class ExceptionUtils
    extends Object
    • Constructor Detail

      • ExceptionUtils

        protected ExceptionUtils()
        protected to avoid direct instanciation but allowing subclassing.
    • Method Detail

      • throwIllegalArgumentExceptionIfTrue

        public static void throwIllegalArgumentExceptionIfTrue​(boolean condition,
                                                               String exceptionMessage,
                                                               Object... exceptionMessageArgs)
        Throws a IllegalArgumentException if given condition is true with message formatted with given arguments using String.format(String, Object...).
        Parameters:
        condition - condition that will trigger the IllegalArgumentException if true
        exceptionMessage - message set in thrown IllegalArgumentException
        exceptionMessageArgs - arguments to be used to format exceptionMessage
        Throws:
        IllegalArgumentException - if condition is true