Class ResourceFingerprintVisitor

  • All Implemented Interfaces:
    Visitor

    public class ResourceFingerprintVisitor
    extends PathAwareVisitor
    Compute a cryptographic hash of the visited nodes, skipping those which may be altered by the persistence layer.
    • Constructor Detail

      • ResourceFingerprintVisitor

        public ResourceFingerprintVisitor​(byte[] salt)
        Public constructor. Uses the given salt
        Parameters:
        salt -
      • ResourceFingerprintVisitor

        public ResourceFingerprintVisitor​(SaltHash baseline)
        Public constructor. Uses the salt from the given SaltHash Preferred, to avoid confusion between salt and hash
        Parameters:
        baseline -
      • ResourceFingerprintVisitor

        public ResourceFingerprintVisitor()
        Public constructor. Generates a new salt
    • Method Detail

      • getSaltAndHash

        public SaltHash getSaltAndHash()
        Compute the digest and return the result along with the salt that was used
        Returns:
      • visit

        public boolean visit​(java.lang.String elementName,
                             int index,
                             String value)
        Description copied from class: DefaultVisitor
        Delegates to #visit(elementName, elementIndex, Element)
        Specified by:
        visit in interface Visitor
        Overrides:
        visit in class DefaultVisitor
        Returns:
        true if the children of this string should be visited; otherwise false
      • visit

        public boolean visit​(java.lang.String elementName,
                             int index,
                             Instant value)
        Description copied from class: DefaultVisitor
        Delegates to #visit(elementName, elementIndex, Element)
        Specified by:
        visit in interface Visitor
        Overrides:
        visit in class DefaultVisitor
        Returns:
        true if the children of this instant should be visited; otherwise false
      • doVisit

        public void doVisit​(java.lang.String elementName,
                            byte[] value)
        Overrides:
        doVisit in class PathAwareVisitor
      • doVisit

        public void doVisit​(java.lang.String elementName,
                            java.math.BigDecimal value)
        Overrides:
        doVisit in class PathAwareVisitor
      • doVisit

        public void doVisit​(java.lang.String elementName,
                            java.lang.Boolean value)
        Overrides:
        doVisit in class PathAwareVisitor
      • doVisit

        public void doVisit​(java.lang.String elementName,
                            java.lang.Integer value)
        Overrides:
        doVisit in class PathAwareVisitor
      • doVisit

        public void doVisit​(java.lang.String elementName,
                            java.time.LocalDate value)
        Overrides:
        doVisit in class PathAwareVisitor
      • doVisit

        public void doVisit​(java.lang.String elementName,
                            java.time.LocalTime value)
        Overrides:
        doVisit in class PathAwareVisitor
      • doVisit

        public void doVisit​(java.lang.String elementName,
                            java.lang.String value)
        Overrides:
        doVisit in class PathAwareVisitor
      • doVisit

        public void doVisit​(java.lang.String elementName,
                            java.time.Year value)
        Overrides:
        doVisit in class PathAwareVisitor
      • doVisit

        public void doVisit​(java.lang.String elementName,
                            java.time.YearMonth value)
        Overrides:
        doVisit in class PathAwareVisitor
      • doVisit

        public void doVisit​(java.lang.String elementName,
                            java.time.ZonedDateTime value)
        Overrides:
        doVisit in class PathAwareVisitor
      • updateDigest

        protected void updateDigest​(java.lang.String name,
                                    java.lang.String value)
        Update the digest with the name/value pair
        Parameters:
        name -
        value -
      • includePath

        protected boolean includePath()
        Test whether or not the current path value should be included in the fingerprint
        Returns: