Top Description Fields Constructors Methods
org.hibernate.engine.jdbc.internal

public final Class HighlightingFormatter

extends Object
implements Formatter
Class Inheritance
All Implemented Interfaces
org.hibernate.engine.jdbc.internal.Formatter
Imports
org.hibernate.engine.jdbc.env.spi.AnsiSqlKeywords, org.hibernate.internal.util.StringHelper, java.util.Arrays, .HashSet, .Set, .StringTokenizer

Performs basic syntax highlighting for SQL using ANSI escape codes.
Author
Gavin King

Field Summary

Modifier and TypeField and Description
public static final Formatter
private final String
private static final Set<String>
private final String
private final String
private final String
private static final String

Constructor Summary

AccessConstructor and Description
public
HighlightingFormatter(String
the ANSI escape code to use for highlighting SQL keywords
keywordCode
,
String
the ANSI escape code to use for highlighting SQL strings
stringCode
,
String quotedCode)

Method Summary

Modifier and TypeMethod and Description
private static String
escape(String code)

public String
format(String
The original SQL string
sql
)

Implements org.hibernate.engine.jdbc.internal.Formatter.format.

Format the source SQL string.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

INSTANCEback to summary
public static final Formatter INSTANCE
keywordEscapeback to summary
private final String keywordEscape
KEYWORDSback to summary
private static final Set<String> KEYWORDS
normalEscapeback to summary
private final String normalEscape
quotedEscapeback to summary
private final String quotedEscape
stringEscapeback to summary
private final String stringEscape
SYMBOLS_AND_WSback to summary
private static final String SYMBOLS_AND_WS

Constructor Detail

HighlightingFormatterback to summary
public HighlightingFormatter(String keywordCode, String stringCode, String quotedCode)
Parameters
keywordCode:String

the ANSI escape code to use for highlighting SQL keywords

stringCode:String

the ANSI escape code to use for highlighting SQL strings

Method Detail

escapeback to summary
private static String escape(String code)
formatback to summary
public String format(String sql)

Implements org.hibernate.engine.jdbc.internal.Formatter.format.

Doc from org.hibernate.engine.jdbc.internal.Formatter.format.

Format the source SQL string.

Parameters
sql:String

The original SQL string

Returns:String

The formatted version

Annotations
@Override