Module bus.setting

Class CommentFormatter

java.lang.Object
org.miaixz.bus.setting.format.AbstractFormatter<IniComment>
org.miaixz.bus.setting.format.CommentFormatter
All Implemented Interfaces:
ElementFormatter<IniComment>

public class CommentFormatter extends AbstractFormatter<IniComment>
A formatter that parses a string value into an IniComment object.
Since:
Java 17+
Author:
Kimi Liu
  • Constructor Details

    • CommentFormatter

      public CommentFormatter(char startChar)
      Constructs a CommentFormatter with a specific starting character.
      Parameters:
      startChar - The character that identifies a comment line.
    • CommentFormatter

      public CommentFormatter()
      Constructs a CommentFormatter with the default starting character ('#').
  • Method Details

    • format

      public IniComment format(String value, int line)
      Formats a comment string into an IniComment object.
      Parameters:
      value - The raw string line, including the starting comment character.
      line - The line number in the original file.
      Returns:
      The parsed IniComment object.
    • check

      public boolean check(String value)
      Checks if the given string value is a comment.
      Parameters:
      value - The string to check.
      Returns:
      true if the string starts with the configured comment character.