Module bus.setting

Interface IniElement

All Superinterfaces:
CharSequence, Serializable
All Known Subinterfaces:
IniComment, IniProperty, IniSection
All Known Implementing Classes:
AbstractElement, IniCommentService, IniPropertyService, IniSectionService

public interface IniElement extends CharSequence, Serializable
IniElement, like sections, properties, comments. they all can be like String .
Since:
Java 17+
Author:
Kimi Liu
  • Method Details

    • value

      String value()
      this element's value. maybe a toString value like comment, a property's value like property or a title value like section .
      Returns:
      some value
    • setValue

      String setValue(String newValue)
      change this element's value.
      Parameters:
      newValue - a new value
      Returns:
      old value
      See Also:
    • getComment

      IniComment getComment()
      there may be comments at the end of each element. or null. if this element is comment, return null. so, nullable, or see getCommentOptional().
      Returns:
      comment end of the element or null. if element, return null.
      See Also:
    • clearComment

      void clearComment()
      clear comment (if exists).
    • toNoCommentString

      String toNoCommentString()
      like toString(), without comment value(if exists).
      Returns:
      to string value without comment value.
    • toCompleteString

      String toCompleteString()
      Get complete information. Take sec as an example:section.toString() + all properties.toString() + comment.toString() In general, it is about the same as toString().
      Returns:
      the string
    • toString

      String toString()
      need to override toString method, to show complete information.
      Specified by:
      toString in interface CharSequence
      Overrides:
      toString in class Object
      Returns:
      to string value.
    • getOriginalValue

      String getOriginalValue()
      get the original string.
      Returns:
      original string value.
    • line

      int line()
      the line number where you are.
      Returns:
      line number.
    • getCommentOptional

      default Optional<IniComment> getCommentOptional()
      there may be comments at the end of each element. if this element is comment, return itself.
      Returns:
      comment end of the element. if element, return itself.
      See Also:
    • setValue

      default String setValue(Function<String,String> valueEditor)
      Edit the value of this element on the basis of original value .
      Parameters:
      valueEditor - function to edit old value, oldValue -> { // edit ... return newValue; }
      Returns:
      old value
    • isComment

      default boolean isComment()
      Am I comment?
      Returns:
      is it a comment?
    • isProperty

      default boolean isProperty()
      Am I property?
      Returns:
      is it a property?
    • isSection

      default boolean isSection()
      Am I section?
      Returns:
      is it a section?