Class DynamicConfigManager


  • public class DynamicConfigManager
    extends java.lang.Object
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      boolean load​(java.lang.Object target)
      Load config into target.
      void openEditor()  
      boolean reload​(java.lang.Object target)
      Reload the config from file into the provided target object.
      void save​(java.lang.Object target)
      Save only annotated fields to JSON.
      void setConfigFile​(java.io.File file)  
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DynamicConfigManager

        public DynamicConfigManager()
    • Method Detail

      • setConfigFile

        public void setConfigFile​(java.io.File file)
      • load

        public boolean load​(java.lang.Object target)
                     throws java.io.IOException,
                            java.lang.ReflectiveOperationException
        Load config into target. Only fields annotated with @ConfigKey are considered.
        Parameters:
        target - the object to populate
        Returns:
        true on success
        Throws:
        java.io.IOException - if file IO fails
        java.lang.ReflectiveOperationException
      • reload

        public boolean reload​(java.lang.Object target)
        Reload the config from file into the provided target object. Uses same filtering as load().
        Parameters:
        target - object to update
        Returns:
        true on success
      • save

        public void save​(java.lang.Object target)
                  throws java.io.IOException,
                         java.lang.ReflectiveOperationException
        Save only annotated fields to JSON.
        Parameters:
        target - object to save
        Throws:
        java.io.IOException
        java.lang.ReflectiveOperationException
      • openEditor

        public void openEditor()
      • close

        public void close()