Module bus.setting

Interface ElementFormatter<E extends IniElement>

Type Parameters:
E - The type of IniElement this formatter produces.
All Known Implementing Classes:
AbstractFormatter, CommentFormatter, PropertyFormatter, SectionFormatter

public interface ElementFormatter<E extends IniElement>
An interface for formatters that convert a string value from a configuration file into a specific IniElement type.
Since:
Java 17+
Author:
Kimi Liu
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    check(String value)
    Checks if this formatter can handle the given string value.
    format(String value, int line)
    Formats the string value into an element of type E.
  • Method Details

    • check

      boolean check(String value)
      Checks if this formatter can handle the given string value.
      Parameters:
      value - The string value to check.
      Returns:
      true if this formatter can process the value, false otherwise.
    • format

      E format(String value, int line)
      Formats the string value into an element of type E. This method assumes that check(String) has already returned true for the given value.
      Parameters:
      value - A string value that this formatter can handle.
      line - The line number where the value originated.
      Returns:
      The formatted IniElement, which should not be null.