List of usage examples for org.apache.commons.lang.math Range getMaximumNumber
public abstract Number getMaximumNumber();
Gets the maximum number in this range.
From source file:org.mili.core.lang.ASFValidate.java
/** * <p>/*from w w w. j av a 2 s . c o m*/ * Checks if a number is in range and throws <code>IllegalArgumentException</code>, if * number is out of range. * </p> * * <p>The method is used to check numbers in range or not. As example if a port parameter is * checked.</p> * * <pre> * ASFValidate.isInRange(13, new IntegerRange(1, 10), "Not in range!"); * </pre> * * @param n number. * @param r range. * @param message message if number is not in range. * @throws IllegalArgumentException if number is not in range. */ public static void isInRange(Number n, Range r, String message) { Validate.notNull(n, "number can't be null!"); Validate.notNull(r, "range can't be null!"); if (message == null) { message = "The validated number[" + n + "] is not in range[" + r.getMinimumNumber() + ".." + r.getMaximumNumber() + "]"; } Validate.isTrue(r.containsNumber(n), message); }