Package com.tnsai.quality.redaction
Record Class RedactionPattern
java.lang.Object
java.lang.Record
com.tnsai.quality.redaction.RedactionPattern
- Record Components:
name- stable identifier ("email","credit_card")regex- compiled patternseverity- how serious a match isvalidator- optional secondary check on the matched substring; returntrueto accept the match
public record RedactionPattern(String name, Pattern regex, Severity severity, Predicate<String> validator)
extends Record
One named pattern in a redactor's catalog (issue #80).
Pairs a compiled Pattern with a stable name, severity tier,
and an optional validator for patterns that have a structural
check beyond the regex (Luhn check on credit cards, TC Kimlik
checksum). When the validator is present and returns false
for a regex match, the match is suppressed — keeps false positives
down on numeric patterns that are easy to false-match.
- Since:
- 0.5.0 (issue #80)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.name()Returns the value of thenamerecord component.static RedactionPatternConvenience: pattern without a structural validator.static RedactionPatternConvenience: pattern with a custom validator.regex()Returns the value of theregexrecord component.severity()Returns the value of theseverityrecord component.final StringtoString()Returns a string representation of this record class.Returns the value of thevalidatorrecord component.
-
Constructor Details
-
Method Details
-
of
Convenience: pattern without a structural validator. -
of
public static RedactionPattern of(String name, String regex, Severity severity, Predicate<String> validator) Convenience: pattern with a custom validator. -
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. -
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. -
equals
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. All components in this record class are compared withObjects::equals(Object,Object). -
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
regex
Returns the value of theregexrecord component.- Returns:
- the value of the
regexrecord component
-
severity
Returns the value of theseverityrecord component.- Returns:
- the value of the
severityrecord component
-
validator
Returns the value of thevalidatorrecord component.- Returns:
- the value of the
validatorrecord component
-