Class ConfigurationSectionBuilder

java.lang.Object
io.github.monsieurdoceo.filizer.storage.domain.ConfigurationSectionBuilder

public class ConfigurationSectionBuilder extends Object
Represents a configuration section that can be created and populated inside a FileConfiguration.

A FileSection stores key-value pairs internally until createSection(FileConfiguration) is called.

  • Constructor Details

    • ConfigurationSectionBuilder

      public ConfigurationSectionBuilder(String name)
      Creates a new empty file section.
      Parameters:
      name - the name of the configuration section
  • Method Details

    • set

      public ConfigurationSectionBuilder set(String name, Object value)
      Adds or replaces a value in this section.
      Parameters:
      name - the key to store
      value - the value associated with the key
      Returns:
      this section instance for chaining
    • replaceData

      public ConfigurationSectionBuilder replaceData(Map<String,Object> data)
      Replaces the current section data.
      Parameters:
      data - the new section data
      Returns:
      this section instance for chaining
    • createSection

      public void createSection(org.bukkit.configuration.file.FileConfiguration config)
      Creates this section in the provided configuration.
      Parameters:
      config - the configuration in which to create the section
      Throws:
      NullPointerException - if the configuration is null
    • getName

      public String getName()
      Returns the name of this section.
      Returns:
      the section name
    • getData

      public Map<String,Object> getData()
      Returns the data stored in this section.
      Returns:
      the section's key-value mappings