Class AnnotatedConfig

java.lang.Object
me.hsgamer.hscore.config.DecorativeConfig
me.hsgamer.hscore.config.annotated.AnnotatedConfig
All Implemented Interfaces:
Config

public class AnnotatedConfig extends DecorativeConfig
The annotated Config, where any fields can be assigned to the config with the annotation ConfigPath. If the field is a final non-static, don't set default value directly, use constructor instead.
 public class ExampleConfig extends AnnotatedConfig {
   @ConfigPath("test1.path")
   private final String test1 = "test1"; // If the field is final, Don't do this
   @ConfigPath("test2.path")
   private final String test2; // Do this instead

   public ExampleConfig(Config config) {
     super(config);
     test2 = "test2"; // Set default value via the constructor
   }
 }
 
  • Constructor Details

    • AnnotatedConfig

      public AnnotatedConfig(Config config)
      Create an annotated config
      Parameters:
      config - the original config
  • Method Details

    • setup

      public void setup()
      Description copied from interface: Config
      Set up the configuration
      Specified by:
      setup in interface Config
      Overrides:
      setup in class DecorativeConfig
    • set

      public void set(Object value, String... path)
      Description copied from interface: Config
      Set the value to the path
      Specified by:
      set in interface Config
      Overrides:
      set in class DecorativeConfig
      Parameters:
      value - the value
      path - the path
    • reload

      public void reload()
      Description copied from interface: Config
      Reload the configuration
      Specified by:
      reload in interface Config
      Overrides:
      reload in class DecorativeConfig