Class HashValidator


  • public final class HashValidator
    extends java.lang.Object
    • Constructor Detail

      • HashValidator

        public HashValidator()
      • HashValidator

        public HashValidator​(java.lang.String hashDescription)
      • HashValidator

        public HashValidator​(java.lang.String refDescription,
                             java.lang.String hashDescription)
    • Method Detail

      • validate

        public void validate​(org.projectnessie.versioned.NamedRef namedRef,
                             @Nullable @Nullable
                             org.projectnessie.services.hash.ParsedHash parsed)
        Validates the provided ref and hash.
        Parameters:
        namedRef - the namedRef, required.
        parsed - the parsed hash, or null if no hash was provided.
      • refMustBeBranch

        @CanIgnoreReturnValue
        public HashValidator refMustBeBranch()
        Validates that a named ref is a branch.
      • refMustBeBranchOrTag

        @CanIgnoreReturnValue
        public HashValidator refMustBeBranchOrTag()
        Validates that a named ref is a branch or a tag.
      • hashMustBeUnambiguous

        @CanIgnoreReturnValue
        public HashValidator hashMustBeUnambiguous()
        Validates that a hash is unambiguous. A hash is unambiguous if it is present and starts with an absolute part, because it will always resolve to the same hash, even if it also has relative parts.