Class ConfigNodeHash
java.lang.Object
tech.guilhermekaua.spigotboot.config.folder.ConfigNodeHash
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 Summary
Modifier and TypeMethodDescriptionstatic @NotNull Stringcanonicalize(@NotNull ConfigNode node) Creates a canonical string representation of the node.static @NotNull Stringsha256(@NotNull ConfigNode node) Computes an SHA-256 hash of the config node's canonical form.
-
Method Details
-
sha256
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
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
-