java.lang.Object
org.miaixz.bus.setting.metric.ini.INI
A builder for creating an
IniSetting object programmatically. It provides a fluent API to add sections,
properties, and comments.-
Constructor Summary
ConstructorsConstructorDescriptionINI()Constructs a new, empty INI builder.INI(Supplier<List<IniElement>> listSupplier) Constructs a new INI builder with a custom list supplier. -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds the finalIniSettingobject from the added elements.commentCreator(IniCommentCreator iniCommentCreator) Sets the creator function for comments.plus(List<IniElement> elements) Appends a list ofIniElements to this builder.Appends all elements from another INI builder to this one.plusComment(String value) Adds a comment line.plusProperties(Properties properties) Adds all properties from aPropertiesobject to the current section.plusProperties(Properties properties, String commentValue) Adds all properties from aPropertiesobject to the current section, each with the same comment string.plusProperties(Properties properties, IniComment comment) Adds all properties from aPropertiesobject to the current section, each with the same comment.plusProperty(String key, String value) Adds a new property (key-value pair) to the current section.plusProperty(String key, String value, String commentValue) Adds a new property to the current section with a comment string.plusProperty(String key, String value, IniComment comment) Adds a new property to the current section with a comment.plusSection(String value) Adds a new section.plusSection(String value, String commentValue) Adds a new section with a comment string.plusSection(String value, IniComment comment) Adds a new section with a comment.propertyCreator(IniPropertyCreator iniPropertyCreator) Sets the creator function for properties.sectionCreator(IniSectionCreator iniSectionCreator) Sets the creator function for sections.skipLine(int length) Skips a specified number of lines by adding null elements, which represent empty lines.
-
Constructor Details
-
INI
public INI()Constructs a new, empty INI builder. -
INI
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
Sets the creator function for sections.- Parameters:
iniSectionCreator- TheIniSectionCreatorto use.- Returns:
- This builder instance for chaining.
-
commentCreator
Sets the creator function for comments.- Parameters:
iniCommentCreator- TheIniCommentCreatorto use.- Returns:
- This builder instance for chaining.
-
propertyCreator
Sets the creator function for properties.- Parameters:
iniPropertyCreator- TheIniPropertyCreatorto use.- Returns:
- This builder instance for chaining.
-
skipLine
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
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
Appends a list ofIniElements to this builder.- Parameters:
elements- The list of INI elements to append.- Returns:
- This builder instance for chaining.
-
plusSection
Adds a new section.- Parameters:
value- The name of the section.- Returns:
- This builder instance for chaining.
-
plusSection
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
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
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
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
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
Adds all properties from aPropertiesobject to the current section.- Parameters:
properties- ThePropertiesobject.- Returns:
- This builder instance for chaining.
-
plusProperties
Adds all properties from aPropertiesobject to the current section, each with the same comment.- Parameters:
properties- ThePropertiesobject.comment- The comment to associate with each property.- Returns:
- This builder instance for chaining.
-
plusProperties
Adds all properties from aPropertiesobject to the current section, each with the same comment string.- Parameters:
properties- ThePropertiesobject.commentValue- The text of the comment for each property.- Returns:
- This builder instance for chaining.
-
plusComment
Adds a comment line.- Parameters:
value- The text of the comment.- Returns:
- This builder instance for chaining.
-
build
Builds the finalIniSettingobject from the added elements.- Returns:
- The constructed
IniSetting.
-