public static <T extends Comparable<? super T>> T requireInRange(T value, String description, T lower, T upper) {
        if (lower.compareTo(upper) > 0) throw new IllegalArgumentException("lower bound cannot be greater than upper bound, " +
                                                                           "but got '" + lower + "' > '" + upper + "'");
        return require(lower.compareTo(value) <= 0 && upper.compareTo(value) >= 0, value,
                       description + " must be at least '" + lower + "' and at most '" + upper + "'");
    }
Requires the value to be at least the lower bound, and at most the upper bound.
vespajlib/src/main/java/ai/vespa/validation/Validation.java