Class ConfigWrapper<C extends Config>

java.lang.Object
com.electronwill.nightconfig.core.utils.UnmodifiableConfigWrapper<C>
com.electronwill.nightconfig.core.utils.ConfigWrapper<C>
All Implemented Interfaces:
Config, UnmodifiableConfig
Direct Known Subclasses:
CommentedConfigWrapper, ConvertedCommentedConfig, ConvertedCommentedFileConfig, ConvertedConfig, ConvertedFileConfig, FakeCommentedConfig

public abstract class ConfigWrapper<C extends Config> extends UnmodifiableConfigWrapper<C> implements Config
  • Constructor Details

    • ConfigWrapper

      protected ConfigWrapper(C config)
  • Method Details

    • entrySet

      public Set<? extends Config.Entry> entrySet()
      Description copied from interface: UnmodifiableConfig
      Returns a Set view of the config's entries. If the config is unmodifiable then the returned set is unmodifiable too.
      Specified by:
      entrySet in interface Config
      Specified by:
      entrySet in interface UnmodifiableConfig
      Overrides:
      entrySet in class UnmodifiableConfigWrapper<C extends Config>
      Returns:
      a Set view of the config's entries.
    • set

      public <T> T set(List<String> path, Object value)
      Description copied from interface: Config
      Sets a config value.
      Specified by:
      set in interface Config
      Type Parameters:
      T - the type of the old value
      Parameters:
      path - the value's path, each element of the list is a different part of the path.
      value - the value to set
      Returns:
      the old value if any, or null
    • add

      public boolean add(List<String> path, Object value)
      Description copied from interface: Config
      Adds a config value. The value is set iff there is no value associated with the given path.
      Specified by:
      add in interface Config
      Parameters:
      path - the value's path, each element of the list is a different part of the path.
      value - the value to set
      Returns:
      true if the value has been added, false if a value is already associated with the given path
    • remove

      public <T> T remove(List<String> path)
      Description copied from interface: Config
      Removes a value from the config.
      Specified by:
      remove in interface Config
      Type Parameters:
      T - the type of the old value
      Parameters:
      path - the value's path, each element of the list is a different part of the path.
      Returns:
      the old value if any, or null
    • clear

      public void clear()
      Description copied from interface: Config
      Removes all values from the config.
      Specified by:
      clear in interface Config
    • createSubConfig

      public Config createSubConfig()
      Description copied from interface: Config
      Creates a new sub config of this config, as created when a subconfig's creation is implied by Config.set(List, Object) or Config.add(List, Object).
      Specified by:
      createSubConfig in interface Config
      Returns:
      a new sub config
    • toString

      public String toString()
      Overrides:
      toString in class Object