Package com.tnsai.quality.redaction
Class CompositeRedactor
java.lang.Object
com.tnsai.quality.redaction.CompositeRedactor
- All Implemented Interfaces:
Redactor
Pipes input through a chain of
Redactors in order (issue #80).
Each redactor's output text feeds the next, and findings concatenate
across the chain.
Composition lets operators stack a fast-path PatternRedactor
(catches credentials + structured PII) with a heavier
LLM-classifier or Presidio bridge (catches names / addresses /
health information that don't pattern-match cleanly) without either
implementation knowing about the other.
Order matters: the first redactor's placeholders ([REDACTED:...])
pass through every later redactor unchanged, so a downstream LLM
classifier doesn't get to "explain" what was already scrubbed.
- Since:
- 0.5.0 (issue #80)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanmaybeContainsSensitive(String input) Cheap pre-check: returnstruewheninputmight contain something worth scanning.static CompositeRedactorscrubString(String input, RedactionContext ctx) Scrub sensitive patterns out ofinput, returning the redacted text + every match.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.tnsai.quality.redaction.Redactor
scrubValue
-
Constructor Details
-
CompositeRedactor
-
-
Method Details
-
of
-
scrubString
Description copied from interface:RedactorScrub sensitive patterns out ofinput, returning the redacted text + every match.- Specified by:
scrubStringin interfaceRedactor- Parameters:
input- plaintext to scan; never null.""is acceptable and returns an unchanged result.ctx- per-call context (sink, tenant policy)- Returns:
- redacted text + findings; never null
-
maybeContainsSensitive
Description copied from interface:RedactorCheap pre-check: returnstruewheninputmight contain something worth scanning. Lets the framework short-circuit the regex loop on guaranteed-clean strings (UUIDs, numeric IDs, fixed-vocabulary enums). Defaulttruebecause the safe fallback is "always scan"; override when you can do better.- Specified by:
maybeContainsSensitivein interfaceRedactor
-