/** * Throws out an {@link InvalidArgException} when `tester` is `false`. * @param tester * when `false` then throws out the exception */ public static void invalidArgIfNot(boolean tester) { if (!tester) { throw new InvalidArgException(); } }
/** * Convert to corresponding JDK exception. Warning, since there are synchronized method execution * please beware of the performance issue when calling this method * @return the JDK {@link IllegalArgumentException} converted from this exception */ public IllegalArgumentException asJDKException() { IllegalArgumentException e = new IllegalArgumentException(getMessage()) { @Override public synchronized Throwable fillInStackTrace() { return this; } }; e.setStackTrace(getStackTrace()); return e; }
/** * Convert to corresponding JDK exception. Warning, since there are synchronized method execution * please beware of the performance issue when calling this method * @return the JDK {@link IllegalArgumentException} converted from this exception */ public IllegalArgumentException asJDKException() { IllegalArgumentException e = new IllegalArgumentException(getMessage()) { @Override public synchronized Throwable fillInStackTrace() { return this; } }; e.setStackTrace(getStackTrace()); return e; }
/** * Throws out an {@link InvalidArgException}. */ public static InvalidArgException invalidArg() { throw new InvalidArgException(); }
/** * Throws out an {@link InvalidArgException} when `tester` is `false`. * @param tester * when `false` then throws out the exception */ public static void invalidArgIfNot(boolean tester) { if (!tester) { throw new InvalidArgException(); } }
/** * Throws out an {@link InvalidArgException} when `tester` is `true`. * @param tester * when `true` then throws out the exception */ public static void invalidArgIf(boolean tester) { if (tester) { throw new InvalidArgException(); } }
/** * Throws out an {@link InvalidArgException} with error message specified. * * @param msg * the error message format pattern. * @param args * the error message format arguments. */ public static InvalidArgException invalidArg(String msg, Object... args) { throw new InvalidArgException(msg, args); }
/** * Throws out an {@link InvalidArgException} when `tester` is `true`. * @param tester * when `true` then throws out the exception */ public static void invalidArgIf(boolean tester) { if (tester) { throw new InvalidArgException(); } }
/** * Throws out an {@link InvalidArgException} with error message specified. * * @param msg * the error message format pattern. * @param args * the error message format arguments. */ public static InvalidArgException invalidArg(String msg, Object... args) { throw new InvalidArgException(msg, args); }
/** * Throws out an {@link InvalidArgException}. */ public static InvalidArgException invalidArg() { throw new InvalidArgException(); }