Class HighlightingFormatter

  • All Implemented Interfaces:
    Formatter

    public final class HighlightingFormatter
    extends Object
    implements Formatter
    Performs basic syntax highlighting for SQL using ANSI escape codes.
    • Field Detail

      • INSTANCE

        public static final Formatter INSTANCE
    • Constructor Detail

      • HighlightingFormatter

        public HighlightingFormatter​(String keywordCode,
                                     String stringCode,
                                     String quotedCode)
        Parameters:
        keywordCode - the ANSI escape code to use for highlighting SQL keywords
        stringCode - the ANSI escape code to use for highlighting SQL strings
    • Method Detail

      • format

        public String format​(String sql)
        Description copied from interface: Formatter
        Format the source SQL string.
        Specified by:
        format in interface Formatter
        Parameters:
        sql - The original SQL string
        Returns:
        The formatted version