Class ConfigNodeHash

java.lang.Object
tech.guilhermekaua.spigotboot.config.folder.ConfigNodeHash

public final class ConfigNodeHash extends Object
Utility for computing semantic hashes of config nodes.

This class provides a way to detect YAML changes while ignoring map key order. Lists are order-sensitive, but maps are not.

The hash uses SHA-256 of a canonical form where:

  • Map keys are sorted lexicographically
  • List items preserve order
  • Scalars are prefixed with a type tag
  • Method Details

    • sha256

      @NotNull public static @NotNull String sha256(@NotNull @NotNull ConfigNode node)
      Computes an SHA-256 hash of the config node's canonical form.
      Parameters:
      node - the config node to hash
      Returns:
      the hex-encoded SHA-256 hash
    • canonicalize

      @NotNull public static @NotNull String canonicalize(@NotNull @NotNull ConfigNode node)
      Creates a canonical string representation of the node.

      This representation ignores map key order but preserves list order.

      Parameters:
      node - the config node
      Returns:
      the canonical string