/** * Check that the named parameter is greater than or equal to {@code min}. * * @param name the parameter name * @param min the minimum value * @param actual the actual parameter value * @throws IllegalArgumentException if the actual value is less than the minimum value */ public static void checkMinimumParameter(String name, double min, double actual) throws IllegalArgumentException { checkNotNullParamChecked("name", name); if (actual < min) throw CommonMessages.msg.paramLessThan(name, min); }
/** * Check that the given offset and length fall completely within the bounds of the given array. * * @param array the array to check * @param offs the array offset * @param len the array length * @throws ArrayIndexOutOfBoundsException if the range of the offset and length do not fall within the array bounds */ public static void checkArrayBounds(final Object[] array, final int offs, final int len) throws ArrayIndexOutOfBoundsException { checkNotNullParamChecked("array", array); checkArrayBounds(array.length, offs, len); }
/** * Check that the named parameter is greater than or equal to {@code min}. * * @param name the parameter name * @param min the minimum value * @param actual the actual parameter value * @throws IllegalArgumentException if the actual value is less than the minimum value */ public static void checkMinimumParameter(String name, long min, long actual) throws IllegalArgumentException { checkNotNullParamChecked("name", name); if (actual < min) throw CommonMessages.msg.paramLessThan(name, min); }
/** * Check that the named parameter is less than or equal to {@code max}. * * @param name the parameter name * @param max the maximum value * @param actual the actual parameter value * @throws IllegalArgumentException if the actual value is greater than the minimum value */ public static void checkMaximumParameter(String name, int max, int actual) throws IllegalArgumentException { checkNotNullParamChecked("name", name); if (actual > max) throw CommonMessages.msg.paramGreaterThan(name, max); }
/** * Check that the named parameter is greater than or equal to {@code min}. * * @param name the parameter name * @param min the minimum value * @param actual the actual parameter value * @throws IllegalArgumentException if the actual value is less than the minimum value */ public static void checkMinimumParameter(String name, float min, float actual) throws IllegalArgumentException { checkNotNullParamChecked("name", name); if (actual < min) throw CommonMessages.msg.paramLessThan(name, min); }
/** * Check that the named parameter is less than or equal to {@code max}. * * @param name the parameter name * @param max the maximum value * @param actual the actual parameter value * @throws IllegalArgumentException if the actual value is greater than the minimum value */ public static void checkMaximumParameter(String name, long max, long actual) throws IllegalArgumentException { checkNotNullParamChecked("name", name); if (actual > max) throw CommonMessages.msg.paramGreaterThan(name, max); }
/** * Check that the named parameter is less than or equal to {@code max}. * * @param name the parameter name * @param max the maximum value * @param actual the actual parameter value * @throws IllegalArgumentException if the actual value is greater than the minimum value */ public static void checkMaximumParameter(String name, double max, double actual) throws IllegalArgumentException { checkNotNullParamChecked("name", name); if (actual > max) throw CommonMessages.msg.paramGreaterThan(name, max); }
/** * Check that the given offset and length fall completely within the bounds of the given array. * * @param array the array to check * @param offs the array offset * @param len the array length * @throws ArrayIndexOutOfBoundsException if the range of the offset and length do not fall within the array bounds */ public static void checkArrayBounds(final byte[] array, final int offs, final int len) throws ArrayIndexOutOfBoundsException { checkNotNullParamChecked("array", array); checkArrayBounds(array.length, offs, len); }
/** * Check that the given offset and length fall completely within the bounds of the given array. * * @param array the array to check * @param offs the array offset * @param len the array length * @throws ArrayIndexOutOfBoundsException if the range of the offset and length do not fall within the array bounds */ public static void checkArrayBounds(final char[] array, final int offs, final int len) throws ArrayIndexOutOfBoundsException { checkNotNullParamChecked("array", array); checkArrayBounds(array.length, offs, len); }
/** * Check that the given offset and length fall completely within the bounds of the given array. * * @param array the array to check * @param offs the array offset * @param len the array length * @throws ArrayIndexOutOfBoundsException if the range of the offset and length do not fall within the array bounds */ public static void checkArrayBounds(final long[] array, final int offs, final int len) throws ArrayIndexOutOfBoundsException { checkNotNullParamChecked("array", array); checkArrayBounds(array.length, offs, len); }
/** * Check that the named parameter is greater than or equal to {@code min}. * * @param name the parameter name * @param min the minimum value * @param actual the actual parameter value * @throws IllegalArgumentException if the actual value is less than the minimum value */ public static void checkMinimumParameter(String name, int min, int actual) throws IllegalArgumentException { checkNotNullParamChecked("name", name); if (actual < min) throw CommonMessages.msg.paramLessThan(name, min); }
/** * Check that the named parameter is less than or equal to {@code max}. * * @param name the parameter name * @param max the maximum value * @param actual the actual parameter value * @throws IllegalArgumentException if the actual value is greater than the minimum value */ public static void checkMaximumParameter(String name, float max, float actual) throws IllegalArgumentException { checkNotNullParamChecked("name", name); if (actual > max) throw CommonMessages.msg.paramGreaterThan(name, max); }
/** * Check that the given offset and length fall completely within the bounds of the given array. * * @param array the array to check * @param offs the array offset * @param len the array length * @throws ArrayIndexOutOfBoundsException if the range of the offset and length do not fall within the array bounds */ public static void checkArrayBounds(final int[] array, final int offs, final int len) throws ArrayIndexOutOfBoundsException { checkNotNullParamChecked("array", array); checkArrayBounds(array.length, offs, len); }
/** * Check that the named parameter is not empty. Use a standard exception message if it is. * * @param name the parameter name * @param value the parameter value * @return the value that was passed in * @throws IllegalArgumentException if the value is empty */ @NotNull public static <K, V, T extends Map<K, V>> T checkNotEmptyParam(String name, T value) { checkNotNullParamChecked("name", name); checkNotNullParamChecked("value", value); if (value.isEmpty()) throw CommonMessages.msg.emptyParam(name); return value; }
/** * Check that the named parameter is not empty. Use a standard exception message if it is. * * @param name the parameter name * @param value the parameter value * @return the value that was passed in * @throws IllegalArgumentException if the value is empty */ @NotNull public static double[] checkNotEmptyParam(String name, double[] value) { checkNotNullParamChecked("name", name); checkNotNullParamChecked("value", value); if (value.length == 0) throw CommonMessages.msg.emptyParam(name); return value; }
/** * Check that the named parameter is not empty. Use a standard exception message if it is. * * @param name the parameter name * @param value the parameter value * @return the value that was passed in * @throws IllegalArgumentException if the value is empty */ @NotNull public static <E, T extends Collection<E>> T checkNotEmptyParam(String name, T value) { checkNotNullParamChecked("name", name); checkNotNullParamChecked("value", value); if (value.isEmpty()) throw CommonMessages.msg.emptyParam(name); return value; }
/** * Check that the named parameter is not empty. Use a standard exception message if it is. * * @param name the parameter name * @param value the parameter value * @return the value that was passed in * @throws IllegalArgumentException if the value is empty */ @NotNull public static byte[] checkNotEmptyParam(String name, byte[] value) { checkNotNullParamChecked("name", name); checkNotNullParamChecked("value", value); if (value.length == 0) throw CommonMessages.msg.emptyParam(name); return value; }
/** * Check that the named parameter is not empty. Use a standard exception message if it is. * * @param name the parameter name * @param value the parameter value * @return the value that was passed in * @throws IllegalArgumentException if the value is empty */ @NotNull public static int[] checkNotEmptyParam(String name, int[] value) { checkNotNullParamChecked("name", name); checkNotNullParamChecked("value", value); if (value.length == 0) throw CommonMessages.msg.emptyParam(name); return value; }
/** * Check that the named parameter is not empty. Use a standard exception message if it is. * * @param name the parameter name * @param value the parameter value * @return the value that was passed in * @throws IllegalArgumentException if the value is empty */ @NotNull public static short[] checkNotEmptyParam(String name, short[] value) { checkNotNullParamChecked("name", name); checkNotNullParamChecked("value", value); if (value.length == 0) throw CommonMessages.msg.emptyParam(name); return value; }
/** * Return an exception indicating that the current switch case was intended to be unreachable. * * @param obj the switch case value * @return the exception which may be immediately thrown */ @NotNull public static IllegalStateException impossibleSwitchCase(@NotNull Object obj) { Assert.checkNotNullParamChecked("obj", obj); return CommonMessages.msg.impossibleSwitchCase(obj); }