java.lang.Object
org.miaixz.bus.setting.format.AbstractFormatter<IniProperty>
org.miaixz.bus.setting.format.PropertyFormatter
- All Implemented Interfaces:
ElementFormatter<IniProperty>
A formatter that parses a string value into an
IniProperty object (a key-value pair).- Since:
- Java 17+
- Author:
- Kimi Liu
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a PropertyFormatter with a default comment formatter and split character ('=').PropertyFormatter(char split) Constructs a PropertyFormatter with a specific split character and a default comment formatter.PropertyFormatter(char split, CommentFormatter commentElementFormatter) Constructs a PropertyFormatter with a specific split character and comment formatter.PropertyFormatter(CommentFormatter commentElementFormatter) Constructs a PropertyFormatter with a specific comment formatter and default split character ('='). -
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks if the given string value represents a property.Formats the string value into anIniProperty.Methods inherited from class org.miaixz.bus.setting.format.AbstractFormatter
getCommentElementFormatter, setCommentElementFormatter
-
Constructor Details
-
PropertyFormatter
Constructs a PropertyFormatter with a specific comment formatter and default split character ('=').- Parameters:
commentElementFormatter- The formatter for parsing comments.
-
PropertyFormatter
public PropertyFormatter()Constructs a PropertyFormatter with a default comment formatter and split character ('='). -
PropertyFormatter
Constructs a PropertyFormatter with a specific split character and comment formatter.- Parameters:
split- The character separating key and value.commentElementFormatter- The formatter for parsing comments.
-
PropertyFormatter
public PropertyFormatter(char split) Constructs a PropertyFormatter with a specific split character and a default comment formatter.- Parameters:
split- The character separating key and value.
-
-
Method Details
-
check
Checks if the given string value represents a property.- Parameters:
value- The string to check.- Returns:
trueif the string contains the split character.
-
format
Formats the string value into anIniProperty. This method assumes thatcheck(String)has already returned true.- Parameters:
value- A string value in "key=value" format.line- The line number where the value originated.- Returns:
- The parsed
IniProperty, which cannot be null.
-