Module bus.setting

Class INI

java.lang.Object
org.miaixz.bus.setting.metric.ini.INI

public class INI extends Object
A builder for creating an IniSetting object programmatically. It provides a fluent API to add sections, properties, and comments.
  • Constructor Details

    • INI

      public INI()
      Constructs a new, empty INI builder.
    • INI

      public INI(Supplier<List<IniElement>> listSupplier)
      Constructs a new INI builder with a custom list supplier.
      Parameters:
      listSupplier - A supplier that provides the list to store elements in.
  • Method Details

    • sectionCreator

      public INI sectionCreator(IniSectionCreator iniSectionCreator)
      Sets the creator function for sections.
      Parameters:
      iniSectionCreator - The IniSectionCreator to use.
      Returns:
      This builder instance for chaining.
    • commentCreator

      public INI commentCreator(IniCommentCreator iniCommentCreator)
      Sets the creator function for comments.
      Parameters:
      iniCommentCreator - The IniCommentCreator to use.
      Returns:
      This builder instance for chaining.
    • propertyCreator

      public INI propertyCreator(IniPropertyCreator iniPropertyCreator)
      Sets the creator function for properties.
      Parameters:
      iniPropertyCreator - The IniPropertyCreator to use.
      Returns:
      This builder instance for chaining.
    • skipLine

      public INI skipLine(int length)
      Skips a specified number of lines by adding null elements, which represent empty lines.
      Parameters:
      length - The number of lines to skip.
      Returns:
      This builder instance for chaining.
    • plus

      public INI plus(INI otherBuilder)
      Appends all elements from another INI builder to this one.
      Parameters:
      otherBuilder - The other builder whose elements will be appended.
      Returns:
      This builder instance for chaining.
    • plus

      public INI plus(List<IniElement> elements)
      Appends a list of IniElements to this builder.
      Parameters:
      elements - The list of INI elements to append.
      Returns:
      This builder instance for chaining.
    • plusSection

      public INI plusSection(String value)
      Adds a new section.
      Parameters:
      value - The name of the section.
      Returns:
      This builder instance for chaining.
    • plusSection

      public INI plusSection(String value, IniComment comment)
      Adds a new section with a comment.
      Parameters:
      value - The name of the section.
      comment - The comment to associate with the section.
      Returns:
      This builder instance for chaining.
    • plusSection

      public INI plusSection(String value, String commentValue)
      Adds a new section with a comment string.
      Parameters:
      value - The name of the section.
      commentValue - The text of the comment.
      Returns:
      This builder instance for chaining.
    • plusProperty

      public INI plusProperty(String key, String value)
      Adds a new property (key-value pair) to the current section.
      Parameters:
      key - The property key.
      value - The property value.
      Returns:
      This builder instance for chaining.
    • plusProperty

      public INI plusProperty(String key, String value, IniComment comment)
      Adds a new property to the current section with a comment.
      Parameters:
      key - The property key.
      value - The property value.
      comment - The comment to associate with the property.
      Returns:
      This builder instance for chaining.
    • plusProperty

      public INI plusProperty(String key, String value, String commentValue)
      Adds a new property to the current section with a comment string.
      Parameters:
      key - The property key.
      value - The property value.
      commentValue - The text of the comment.
      Returns:
      This builder instance for chaining.
    • plusProperties

      public INI plusProperties(Properties properties)
      Adds all properties from a Properties object to the current section.
      Parameters:
      properties - The Properties object.
      Returns:
      This builder instance for chaining.
    • plusProperties

      public INI plusProperties(Properties properties, IniComment comment)
      Adds all properties from a Properties object to the current section, each with the same comment.
      Parameters:
      properties - The Properties object.
      comment - The comment to associate with each property.
      Returns:
      This builder instance for chaining.
    • plusProperties

      public INI plusProperties(Properties properties, String commentValue)
      Adds all properties from a Properties object to the current section, each with the same comment string.
      Parameters:
      properties - The Properties object.
      commentValue - The text of the comment for each property.
      Returns:
      This builder instance for chaining.
    • plusComment

      public INI plusComment(String value)
      Adds a comment line.
      Parameters:
      value - The text of the comment.
      Returns:
      This builder instance for chaining.
    • build

      public IniSetting build()
      Builds the final IniSetting object from the added elements.
      Returns:
      The constructed IniSetting.