Class OperatorFileWriter.Result

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

public static final class OperatorFileWriter.Result extends Object
The outcome of one write, its one-phrase reason, and the document now on disk when there is one.
  • Field Details

  • Constructor Details

  • Method Details

    • outcome

      public OperatorFileWriter.Outcome outcome()
      What happened.
      Returns:
      the outcome
    • reason

      public String reason()
      Why nothing was written, as a phrase without any value; empty when written or unchanged.
      Returns:
      the reason
    • document

      public ConfigDocument document()
      The edited document, which is what the file now holds, for OperatorFileWriter.Outcome.WRITTEN and OperatorFileWriter.Outcome.UNCHANGED; null otherwise.
      Returns:
      the document or null
    • fingerprint

      public String fingerprint()
      The SHA-256 (lower-case hex, as ConfigLoadResult.fingerprint()) of the bytes the gate wrote, or of the bytes it read when nothing needed writing; null when it did not apply the edit. A caller records this, never a fresh read of the file, as the bytes it last saw, so an edit made after them stays visible.
      Returns:
      the fingerprint or null
    • readFingerprint

      public String readFingerprint()
      The SHA-256 (lower-case hex, or OperatorFileWriter.ABSENT) of the bytes the gate read and verified the edit against - for OperatorFileWriter.Outcome.WRITTEN, the bytes the file held immediately before it was replaced; null when it did not apply the edit. A caller that compares this with the bytes it last bound can tell whether the file it wrote still held only what the caller had read, or also an edit made since.
      Returns:
      the fingerprint of the bytes read, or null
    • applied

      public boolean applied()
      Whether the file now holds the edited document.
      Returns:
      whether the outcome is written or unchanged