Skip to content

Annotations

Tritium Configuration uses a set of annotations to describe metadata and validation rules for configuration fields:

  • @ConfigVersion(int value(), String migration() default "") — marks the configuration version used for migration.
  • @Range(double min() default Double.MIN_VALUE, double max() default Double.MAX_VALUE, String message() default "...") — applies to numeric fields (int/double/long) to define valid ranges.
  • @SubCategory(String value(), String tooltip() default "") — marks a field as a nested subcategory; used by the automatic UI generator to create subcategories.
  • @Validation(String value()) — simple rule string parsed by ConfigValidator (supports minLength, maxLength, regex).
  • @ClientOnly — indicates fields or types that should only be considered in client environment; server environment will skip these fields.

Best practices:

  • Structure configs using static fields and nested static classes so the framework can instantiate a default instance and read defaults.