Package org.egothor.methodatlas.command
Class CommentRedaction
java.lang.Object
org.egothor.methodatlas.command.CommentRedaction
Applies the loaded
CommentRedactors to source text on its way to an
AI provider, failing closed.
The first redactor whose CommentRedactor.supports(Path) accepts the
file performs the redaction. If none does, or the redactor reports it cannot
guarantee redaction, RedactionAbortedException is thrown so that no
un-redacted source can leave the process.
Instances are immutable; thread safety is that of the wrapped redactors.
- Since:
- 4.1.0
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCommentRedaction(List<org.egothor.methodatlas.api.CommentRedactor> redactors) Creates a service over the given redactors. -
Method Summary
Modifier and TypeMethodDescriptionstatic CommentRedactionnone()Returns a service with no redactors, which rejects every file.redactOrThrow(Path file, String source) Returnssourcewith comments blanked by the redactor responsible forfile.
-
Constructor Details
-
CommentRedaction
Creates a service over the given redactors.- Parameters:
redactors- redactors in priority order; must not benull
-
-
Method Details
-
none
Returns a service with no redactors, which rejects every file.- Returns:
- a new empty instance; never
null
-
redactOrThrow
Returnssourcewith comments blanked by the redactor responsible forfile.- Parameters:
file- the file the text came from;nullis treated as an unknown language and rejectedsource- full source text; must not benull- Returns:
- redacted text, same length and line structure as
source - Throws:
RedactionAbortedException- if no redactor supports the file or the redactor fails
-