Annotation Interface IntRange
@Documented
@Retention(RUNTIME)
@Target({TYPE_PARAMETER,TYPE_USE})
@SubtypeOf(UnknownVal.class)
public @interface IntRange
An expression with this type evaluates to an integral value (byte, short, char, int, or long) in
the given range. The bounds are inclusive. For example, the following declaration allows the 12
values 0, 1, ..., 11:
@IntRange(from=0, to=11) int month;
If only one of the to and from fields is set, then the other will default to
the max/min value of the type of the variable that is annotated. (In other words, the defaults
Long.MIN_VALUE and Long.MAX_VALUE are used only for long; appropriate
values are used for other types.)
- See the Checker Framework Manual:
- Constant Value Checker
-
Optional Element Summary
Optional Elements
-
Element Details
-
from
long fromSmallest value in the range, inclusive.- Returns:
- the smallest value in the range, inclusive
- Default:
-9223372036854775808L
-
to
long toLargest value in the range, inclusive.- Returns:
- the largest value in the range, inclusive
- Default:
9223372036854775807L
-