Class OperatorFileWriter.EmptySections

java.lang.Object
com.ultikits.ultitools.config.document.OperatorFileWriter.EmptySections
Enclosing class:
OperatorFileWriter

private static final class OperatorFileWriter.EmptySections extends Object
The sections an insert finds empty (#620, #610 item 2). For every value path the edit inserts, the nearest key above it that the file already holds is its section. When the write does not own that section and the file holds it with no value:
  • left with no value - a block key followed on its line by the colon and nothing else, a comment allowed (messages:, messages: # note), the shape deleting every child leaves - the section is expanded: the write owns that one line, its value may become a mapping holding only the inserted keys, and OperatorFileWriter.markExpandedSection(com.ultikits.ultitools.config.document.OperatorFileWriter.Side, com.ultikits.ultitools.config.document.OperatorFileWriter.Side, java.util.List<java.lang.String>, boolean, boolean) keeps the operator's key text, comment and line terminator on it (owned-span rule revision 3, maintainer decision 2026-10-06: deleting every child is most likely accidental, so the framework keeps the section complete);
  • written as an explicit empty value - ~, null, !!null or {} on a block key - the operator's own value, never reinterpreted as "left empty": the write is refused before rendering (it was refused before as well, by the checks below, with reasons that did not say what to change) with a reason that names the section and its line, never its value, and says what the operator can change.
Any other section - a flow collection holding the key, an explicit ? key, a scalar - is not owned and is left to the existing checks, which refuse a change to it.
  • Field Details

  • Constructor Details

    • EmptySections

      private EmptySections()
  • Method Details

    • of

    • nearestHeldAncestor

      private static List<String> nearestHeldAncestor(ConfigDocument original, List<String> path)
    • ownedAbove

      private static boolean ownedAbove(List<List<String>> changed, List<String> section)
      Whether a value path the write changes is the section itself or a key above it (its line is owned anyway).
    • onBlockKeyLine

      private static boolean onBlockKeyLine(org.yaml.snakeyaml.nodes.NodeTuple tuple, List<String> lines, boolean byteOrderMark)
      A single-line key starting its line (only indentation, or the byte-order mark, before it).
    • endsAfterColon

      private static boolean endsAfterColon(org.yaml.snakeyaml.nodes.NodeTuple tuple, List<String> lines, boolean byteOrderMark)
      Whether the section key's line holds nothing after the colon but spaces and, optionally, a comment.