Record Class RedactionFinding

java.lang.Object
java.lang.Record
com.tnsai.quality.redaction.RedactionFinding
Record Components:
patternName - short stable name of the pattern that fired — "email", "credit_card", "openai_api_key", etc.
startOffset - start index in the pre-redaction input (inclusive)
endOffset - end index in the pre-redaction input (exclusive)
placeholder - the replacement string the redactor wrote in
severity - sensitivity tier of this match

public record RedactionFinding(String patternName, int startOffset, int endOffset, String placeholder, Severity severity) extends Record
One redacted match inside a string (issue #80).

Surfaces enough metadata for an audit trail without exposing the redacted content itself: which pattern, where in the input, what placeholder replaced it, and how serious the match was. Operators get visibility ("we redacted 3 credit-card matches today") without the audit log itself becoming a leak vector.

Since:
0.5.0 (issue #80)
  • Constructor Details

    • RedactionFinding

      public RedactionFinding(String patternName, int startOffset, int endOffset, String placeholder, Severity severity)
      Creates an instance of a RedactionFinding record class.
      Parameters:
      patternName - the value for the patternName record component
      startOffset - the value for the startOffset record component
      endOffset - the value for the endOffset record component
      placeholder - the value for the placeholder record component
      severity - the value for the severity record component
  • Method Details

    • length

      public int length()
      Length of the matched span in the original input.
    • 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
    • hashCode

      public final 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
    • 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 '=='.
      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.
    • patternName

      public String patternName()
      Returns the value of the patternName record component.
      Returns:
      the value of the patternName record component
    • startOffset

      public int startOffset()
      Returns the value of the startOffset record component.
      Returns:
      the value of the startOffset record component
    • endOffset

      public int endOffset()
      Returns the value of the endOffset record component.
      Returns:
      the value of the endOffset record component
    • placeholder

      public String placeholder()
      Returns the value of the placeholder record component.
      Returns:
      the value of the placeholder record component
    • severity

      public Severity severity()
      Returns the value of the severity record component.
      Returns:
      the value of the severity record component