Annotation Interface ConfigOption


@Retention(RUNTIME) @Target(FIELD) public @interface ConfigOption

The ConfigOption annotation is used to mark fields in a class that represent configuration options. It allows specifying a configuration key and a default value for that key. This annotation is intended to be used in conjunction with a configuration manager that can process these annotations to automatically load, save, and repair configuration settings.

When a field in a class is annotated with ConfigOption, it indicates that this field corresponds to a specific setting in the plugin's configuration file. The key element specifies the unique configuration key, and the defaultValue element provides a default value to be used if the configuration does not already contain a value for the key.

Example usage:


 public class SomeClass {
     @ConfigOption(key = "database.url", defaultValue = "jdbc:mysql://localhost:3306/minecraft")
     private String databaseUrl;

     // Other configuration fields...
 }
Since:
2023-12-13
Version:
1.0.0
Author:
notzune
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    The configuration key for this option.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    The default value for this option.
  • Element Details

    • key

      String key
      The configuration key for this option.
      Returns:
      The configuration key.
    • defaultValue

      String defaultValue
      The default value for this option.
      Returns:
      The default value.
      Default:
      ""