/** * Throws out an {@link InvalidRangeException}. */ public static InvalidRangeException invalidRange() { throw new InvalidRangeException(); }
/** * 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 IndexOutOfBoundsException} converted from this excpetion instance */ public IndexOutOfBoundsException asJDKException() { IndexOutOfBoundsException e = new IndexOutOfBoundsException(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 IndexOutOfBoundsException} converted from this excpetion instance */ public IndexOutOfBoundsException asJDKException() { IndexOutOfBoundsException e = new IndexOutOfBoundsException(getMessage()) { @Override public synchronized Throwable fillInStackTrace() { return this; } }; e.setStackTrace(getStackTrace()); return e; } }
/** * Throws out an {@link InvalidRangeException} with error message specified. * @param msg * the error message format pattern. * @param args * the error message format arguments. */ public static InvalidRangeException invalidRange(String msg, Object... args) { throw new InvalidRangeException(msg, args); }
/** * Throws out an {@link InvalidRangeException} with error message specified. * @param msg * the error message format pattern. * @param args * the error message format arguments. */ public static InvalidRangeException invalidRange(String msg, Object... args) { throw new InvalidRangeException(msg, args); }
/** * Throws out an {@link InvalidRangeException}. */ public static InvalidRangeException invalidRange() { throw new InvalidRangeException(); }
/** * Throws out an {@link InvalidRangeException} with error message specified * when `tester` is `false`. * * @param tester * when `false` then throw out the exception * @param msg * the error message format pattern. * @param args * the error message format arguments. */ public static void invalidRangeIfNot(boolean tester, String msg, Object... args) { if (!tester) { throw new InvalidRangeException(msg, args); } }
/** * Throws out an {@link InvalidRangeException} with error message specified * when `tester` is `false`. * * @param tester * when `false` then throw out the exception * @param msg * the error message format pattern. * @param args * the error message format arguments. */ public static void invalidRangeIfNot(boolean tester, String msg, Object... args) { if (!tester) { throw new InvalidRangeException(msg, args); } }