Class DecorativeConfig

java.lang.Object
me.hsgamer.hscore.config.DecorativeConfig
All Implemented Interfaces:
Config
Direct Known Subclasses:
AnnotatedConfig

public abstract class DecorativeConfig extends Object implements Config
A decorative Config for extending more features on the existing Config
  • Field Details

    • config

      protected final Config config
  • Constructor Details

    • DecorativeConfig

      protected DecorativeConfig(Config config)
      Create a new decorative config
      Parameters:
      config - the original config
  • Method Details

    • getOriginalConfig

      public Config getOriginalConfig()
      Get the original config
      Returns:
      the config
    • getOriginal

      public Object getOriginal()
      Description copied from interface: Config
      Get the original instance
      Specified by:
      getOriginal in interface Config
      Returns:
      the original instance
    • get

      public Object get(PathString path, Object def)
      Description copied from interface: Config
      Get the value from the path
      Specified by:
      get in interface Config
      Parameters:
      path - the path
      def - the default value if the value is not found
      Returns:
      the value
    • set

      public void set(PathString path, Object value)
      Description copied from interface: Config
      Set the value to the path
      Specified by:
      set in interface Config
      Parameters:
      path - the path
      value - the value
    • contains

      public boolean contains(PathString path)
      Description copied from interface: Config
      Check if the configuration contains the path
      Specified by:
      contains in interface Config
      Parameters:
      path - the path
      Returns:
      true if it does
    • getName

      public String getName()
      Description copied from interface: Config
      Get the name of the configuration
      Specified by:
      getName in interface Config
      Returns:
      the name
    • setIfAbsent

      public void setIfAbsent(PathString path, Object value)
      Description copied from interface: Config
      Set the value to the path if it is not already set
      Specified by:
      setIfAbsent in interface Config
      Parameters:
      path - the path
      value - the value
    • getValues

      public Map<PathString,Object> getValues(PathString path, boolean deep)
      Description copied from interface: Config
      Get all values from the path
      Specified by:
      getValues in interface Config
      Parameters:
      path - the path
      deep - should we go deeper from the path?
      Returns:
      the values
    • setup

      public void setup()
      Description copied from interface: Config
      Set up the configuration
      Specified by:
      setup in interface Config
    • save

      public void save()
      Description copied from interface: Config
      Save the configuration
      Specified by:
      save in interface Config
    • reload

      public void reload()
      Description copied from interface: Config
      Reload the configuration
      Specified by:
      reload in interface Config
    • normalize

      public Object normalize(Object object)
      Description copied from interface: Config
      Normalize the library-specific object
      Specified by:
      normalize in interface Config
      Parameters:
      object - the object
      Returns:
      the normalized object
    • isNormalizable

      public boolean isNormalizable(Object object)
      Description copied from interface: Config
      Check if the object is normalizable
      Specified by:
      isNormalizable in interface Config
      Parameters:
      object - the object
      Returns:
      true if it is
    • getComment

      public List<String> getComment(PathString path, CommentType type)
      Description copied from interface: Config
      Get the comment. This is a default empty method. The implementation can override this method to support comments.
      Specified by:
      getComment in interface Config
      Parameters:
      path - the path
      type - the comment type
      Returns:
      the comment
    • setComment

      public void setComment(PathString path, List<String> value, CommentType type)
      Description copied from interface: Config
      Set the comment This is a default empty method. The implementation can override this method to support comments.
      Specified by:
      setComment in interface Config
      Parameters:
      path - the path
      value - the comment, can be null to remove the comment
      type - the comment type