Record Class HashedKey

java.lang.Object
java.lang.Record
com.inductiveautomation.ignition.common.i18n.translation.HashedKey
Record Components:
original - The original source key.
computedHash - The hash code computed from the normalized version of the original key.

public record HashedKey(String original, int computedHash) extends Record
A record that pairs an original source key with its computed hash based on a KeyHashRule.
  • Constructor Details

    • HashedKey

      public HashedKey(String original, int computedHash)
      Creates an instance of a HashedKey record class.
      Parameters:
      original - the value for the original record component
      computedHash - the value for the computedHash record component
  • Method Details

    • ofPreHashed

      public static HashedKey ofPreHashed(String original, String adapted)
      Constructs a new HashedKey given a raw input key and the corresponding string that was already hashed.
      Parameters:
      original - The original source key.
      adapted - The input string that's already been adapted via KeyHashRule.getKey(String).
    • getSourceKey

      public String getSourceKey()
    • hashCode

      public int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • original

      public String original()
      Returns the value of the original record component.
      Returns:
      the value of the original record component
    • computedHash

      public int computedHash()
      Returns the value of the computedHash record component.
      Returns:
      the value of the computedHash record component