@Retention(value=CLASS) @Target(value={METHOD,FIELD,PARAMETER,LOCAL_VARIABLE,TYPE_USE}) public @interface Range
@Range asserts that a value falls within [from, to). It is
aimed at library maintainers and static analysis tools that verify argument
ranges.
Retention and effect: Stored in the class file. There is no runtime impact unless Chronicle tooling reads the metadata.
@Range(from = 0, to = 10)
int level;
Limitations: Using Long.MAX_VALUE as to() can lead
to overflow. Use Long.MAX_VALUE - 1 when an inclusive upper bound is
required.
This annotation is also used by Chronicle-Values for bit-packing to
optimise memory layout. The to() value is exclusive by default.
Positive,
Negative,
NonNegative,
NonPositive| Modifier and Type | Optional Element and Description |
|---|---|
long |
from
Specifies the lower bound of the range.
|
long |
to
Specifies the upper bound of the range.
|
String |
value
Specifies an optional comment to provide additional context or rationale for why the
annotated element must be within the specified range.
|
public abstract String value
Copyright © 2026 Chronicle Software Ltd. All rights reserved.