Object WellKnownFileContentTransformers
-
- All Implemented Interfaces:
public class WellKnownFileContentTransformersProvides common implementations of FileContentTransformer for reducing file content bloat. These transformers can be used to clean up file content before sending it to LLMs or other text processing systems to reduce token usage and improve performance by helping them to focus on essential code.
-
-
Field Summary
Fields Modifier and Type Field Description private final StringTransformerremoveApacheLicenseHeaderprivate final StringTransformerremoveDocCommentsprivate final StringTransformerremoveSingleLineCommentsprivate final StringTransformerremoveImportsprivate final StringTransformerremoveEmptyLinesprivate final StringTransformercompressWhitespacepublic final static WellKnownFileContentTransformersINSTANCE
-
Method Summary
Modifier and Type Method Description final List<StringTransformer>allSanitizers()Returns all available sanitizers in a sensible order for maximum content reduction. final List<StringTransformer>minimalSanitizers()Returns a minimal set of sanitizers that preserve code structure while still reducing file size. final List<StringTransformer>commentRemovalSanitizers()Returns sanitizers focused on comment removal only. final List<StringTransformer>whitespaceCleanupSanitizers()Returns sanitizers focused on whitespace cleanup only. final StringTransformergetRemoveApacheLicenseHeader()Removes Apache License headers commonly found at the top of source files. final StringTransformergetRemoveDocComments()Removes documentation comments (/** ... final StringTransformergetRemoveSingleLineComments()Removes single-line comments (// ...) from the code. final StringTransformergetRemoveImports()Removes import statements from the code. final StringTransformergetRemoveEmptyLines()Removes empty lines from file content final StringTransformergetCompressWhitespace()Removes excessive whitespace from file content -
-
Method Detail
-
allSanitizers
final List<StringTransformer> allSanitizers()
Returns all available sanitizers in a sensible order for maximum content reduction. The order is important to ensure proper sanitization.
-
minimalSanitizers
final List<StringTransformer> minimalSanitizers()
Returns a minimal set of sanitizers that preserve code structure while still reducing file size.
-
commentRemovalSanitizers
final List<StringTransformer> commentRemovalSanitizers()
Returns sanitizers focused on comment removal only.
-
whitespaceCleanupSanitizers
final List<StringTransformer> whitespaceCleanupSanitizers()
Returns sanitizers focused on whitespace cleanup only.
-
getRemoveApacheLicenseHeader
final StringTransformer getRemoveApacheLicenseHeader()
Removes Apache License headers commonly found at the top of source files.
-
getRemoveDocComments
final StringTransformer getRemoveDocComments()
Removes documentation comments (/** ... */) from the code.
-
getRemoveSingleLineComments
final StringTransformer getRemoveSingleLineComments()
Removes single-line comments (// ...) from the code.
-
getRemoveImports
final StringTransformer getRemoveImports()
Removes import statements from the code.
-
getRemoveEmptyLines
final StringTransformer getRemoveEmptyLines()
Removes empty lines from file content
-
getCompressWhitespace
final StringTransformer getCompressWhitespace()
Removes excessive whitespace from file content
-
-
-
-