Annotation Interface Range


@Retention(RUNTIME) @Target(METHOD) @Documented public @interface Range
Annotation that specifies the valid numeric range for a configuration item.

When applied to a ConfigItem method that returns a numeric type (int, long, double, etc.), the configuration UI will enforce the specified minimum and maximum values. This may also affect UI presentation, such as displaying a slider instead of a text field.

Example usage:


 @ConfigItem(
     keyName = "tickDelay",
     name = "Tick Delay",
     description = "Number of ticks to wait"
 )
 @Range(min = 1, max = 10)
 default int tickDelay() {
     return 3;
 }
 

See Also:
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    int
    The maximum allowed value (inclusive).
    int
    The minimum allowed value (inclusive).
  • Element Details

    • min

      int min
      The minimum allowed value (inclusive).
      Returns:
      the minimum value, defaults to 0
      Default:
      0
    • max

      int max
      The maximum allowed value (inclusive).
      Returns:
      the maximum value, defaults to Integer.MAX_VALUE
      Default:
      2147483647