public class GFmtOpt extends Object
Create an instance with GFmtOptFactory, finish configuring it,
and pass it to the formatter. Do not modify an instance while formatting is
in progress. The formatter uses sessionId to associate processors
and mediators with this option set.
Every public field is documented with its default and its interaction with related options. Fields in the "Lifecycle and advanced controls" category are public for compatibility but are not ordinary presentation settings.
| Modifier and Type | Field and Description |
|---|---|
boolean |
alignAliasInSelectList
Pads stacked SELECT expressions so their explicit or implicit aliases
begin in the same column.
|
boolean |
alignJoinWithFromKeyword
Aligns the beginning of JOIN phrases with the FROM keyword rather than
with the first table source.
|
boolean |
andOrUnderWhere
Aligns leading AND and OR operators under the WHERE keyword.
|
Integer |
beStyleBlockIndentSize
Adds indentation to statements inside BEGIN/END blocks and to returned
query bodies in supported CREATE FUNCTION and CREATE VIEW forms.
|
Integer |
beStyleBlockLeftBEIndentSize
Adds columns to the containing statement's indentation for a BEGIN token
moved to a new line.
|
Boolean |
beStyleBlockLeftBEOnNewline
Places a procedural BEGIN token on a new line.
|
Integer |
beStyleBlockRightBEIndentSize
Controls END indentation for block paths where BEGIN remains on the current
line.
|
boolean |
beStyleCreatetableLeftBEOnNewline
Places the opening parenthesis of a CREATE TABLE column list on a new line
and indents it by
indentLen. |
boolean |
beStyleCreatetableRightBEOnNewline
Places the closing parenthesis of a CREATE TABLE column list on its own
line.
|
Integer |
beStyleFunctionBodyIndent
Reserved compatibility setting for stored-routine body indentation.
|
Boolean |
beStyleFunctionFirstParamInNewline
Places the first stored-routine parameter on a new line and indents it one
general indentation level beyond its current parameter-list indentation.
|
Integer |
beStyleFunctionLeftBEIndentSize
Adds columns to the current indentation of a stored-routine opening
parenthesis moved to a new line.
|
Boolean |
beStyleFunctionLeftBEOnNewline
Places the opening parenthesis of a stored-routine parameter list on a new
line.
|
Integer |
beStyleFunctionRightBEIndentSize
Adds columns relative to the routine declaration when a parameter-list
closing parenthesis is moved to a new line.
|
Boolean |
beStyleFunctionRightBEOnNewline
Places the closing parenthesis of a stored-routine parameter list on a new
line.
|
Integer |
beStyleIfElseSingleStmtIndentSize
Adds indentation to a single statement controlled by IF or ELSE when the
body is not represented as a BEGIN/END block.
|
TCaseOption |
caseDatatype
Converts tokens recognized as datatype names.
|
TCaseOption |
caseFuncname
Converts tokens recognized by the parser as function names, including
built-in and user-defined calls where classification is available.
|
TCaseOption |
caseIdentifier
Converts unquoted identifier tokens that are not recognized as datatypes
or function names.
|
TCaseOption |
caseKeywords
Converts SQL keyword tokens to the selected case.
|
TCaseOption |
caseQuotedIdentifier
Converts double-quoted identifier contents while preserving the quote
characters.
|
Boolean |
caseWhenThenInSameLine
Keeps each WHEN condition and its THEN keyword on one line when true.
|
TCompactMode |
compactMode
Selects normal pretty-printing or compact output.
|
TAlignOption |
createtableFieldlistAlignOption
Left- or right-aligns CREATE TABLE column names within the widest column-
name width.
|
boolean |
createtableListitemInNewLine
Places the first CREATE TABLE column or constraint on a new line after the
opening parenthesis.
|
Boolean |
cteNewlineBeforeAs
Places the AS keyword of each common table expression on a new line aligned
under the CTE name area.
|
TAlignStyle |
defaultAligntype
Provides stacked or wrapped layout for lists without a dedicated style,
notably UPDATE SET and CREATE TABLE lists.
|
TLinefeedsCommaOption |
defaultCommaOption
Provides comma placement for formatter lists without a dedicated comma
setting, including INSERT columns/values, UPDATE SET items, and CREATE
TABLE columns and constraints.
|
TEmptyLinesOption |
emptyLines
Determines how blank lines found between top-level statements are handled:
remove them, collapse them to one blank line, or preserve their count.
|
boolean |
fromClauseInNewLine
Places the first table source on a new indented line after FROM (and the
corresponding INTO table source where that clause shares this processor).
|
TLinefeedsCommaOption |
functionCallParametersComma
Positions commas when ordinary function-call arguments use stacked layout.
|
TAlignStyle |
functionCallParametersStyle
Chooses stacked or wrapped layout for argument lists in ordinary function
calls.
|
Integer |
indentCaseFromSwitch
Indents WHEN, ELSE, and END relative to the CASE keyword.
|
Integer |
indentCaseThen
Adds indentation to a line-broken THEN relative to its WHEN indentation.
|
Integer |
indentLen
Sets the general indentation increment, in columns, used by nested clauses,
expressions, CTE bodies, parameters, and many statement processors.
|
Boolean |
insertBlankLineInBatchSqls
Inserts a blank line between statements inside supported BEGIN/END batches.
|
TAlignStyle |
insertColumnlistStyle
Chooses stacked or wrapped layout for the target-column list of INSERT.
|
TAlignStyle |
insertValuelistStyle
Chooses stacked or wrapped layout for each INSERT VALUES list.
|
Boolean |
linebreakAfterDeclare
Places the first variable declaration on a new indented line after DECLARE.
|
Boolean |
linebreakBeforeParamInExec
Places the first SQL Server EXEC/EXECUTE argument on a new line, indented by
indentLen from the statement. |
Boolean |
linenumberEnabled
Prefixes every output line with a zero-padded line number.
|
Integer |
linenumberLeftMargin
Inserts this many spaces before each generated line number.
|
Integer |
linenumberRightMargin
Inserts this many spaces between each generated line number and the SQL
text.
|
Boolean |
linenumberZeroBased
Starts generated line numbers at zero when true, or one when false.
|
Integer |
lineWidth
Sets the maximum line width used by compact mode.
|
Integer |
maxSelectListColumn
Limits how many items are stacked at once in large SELECT-style lists.
|
Boolean |
noEmptyLinesBetweenMultiSetStmts
Suppresses the formatter's otherwise automatic blank line between adjacent
SET or DECLARE-family statements.
|
boolean |
opearateSourceToken
Enables the low-level source-token mutation operations that implement
formatting.
|
GOutputFmt |
outputFmt
Selects the renderer used after token formatting.
|
TLinefeedsCommaOption |
parametersComma
Positions commas for stacked stored-routine parameter declarations.
|
TAlignStyle |
parametersStyle
Chooses stacked or wrapped layout for stored-routine, package, trigger, and
supported CREATE VIEW parameter declarations.
|
Boolean |
removeComment
Removes ordinary line and block comments before formatting and reparses the
modified token stream.
|
TLinefeedsCommaOption |
selectColumnlistComma
Chooses whether a comma ends the previous line or begins the next line in
stacked SELECT, GROUP BY, and ORDER BY lists.
|
TAlignStyle |
selectColumnlistStyle
Chooses stacked or wrapped layout for SELECT result columns and is also
reused by GROUP BY and ORDER BY lists.
|
TLinefeedsCommaOption |
selectFromclauseComma
Positions commas for stacked comma-separated FROM items.
|
boolean |
selectFromclauseJoinOnInNewline
Places the ON condition of a JOIN on a separate line.
|
TAlignStyle |
selectFromclauseStyle
Chooses stacked or wrapped layout for comma-separated table sources in a
FROM clause.
|
boolean |
selectItemInNewLine
Places the first SELECT item on a line after SELECT.
|
TAlignOption |
selectKeywordsAlignOption
Left- or right-aligns multiword and single-word query clause labels such as
SELECT, FROM, WHERE, GROUP BY, HAVING, and ORDER BY within their shared
keyword width.
|
String |
sessionId
Identifies the formatting session used by formatter, processor, and
mediator caches.
|
String |
tabHtmlString
Replaces each literal tab in HTML output with this string.
|
Integer |
tabSize
Defines the tab-stop width used by the final tab-alignment pass when
useTab is enabled. |
boolean |
treatDistinctAsVirtualColumn
Adds a synthetic DISTINCT result-column node to the parsed SELECT list so
it participates in stacking and comma-layout calculations.
|
Boolean |
useTab
Enables the final tab-alignment pass.
|
Boolean |
wsPaddingOperatorArithmetic
Inserts one space on both sides of recognized binary arithmetic and
comparison operators.
|
Boolean |
wsPaddingParenthesesInExpression
Inserts one space just inside parentheses that group an expression, for
example
( a + b ). |
Boolean |
wsPaddingParenthesesInFunction
Inserts one space just inside the parameter-list parentheses of CREATE
FUNCTION, PROCEDURE, PACKAGE, and TRIGGER declarations when parameters are
present.
|
Boolean |
wsPaddingParenthesesInFunctionCall
Inserts one space just inside ordinary function-call parentheses.
|
Boolean |
wsPaddingParenthesesOfSubQuery
Inserts one space just inside parentheses that enclose a formatted
subquery.
|
Boolean |
wsPaddingParenthesesOfTypename
Inserts one space just inside datatype-parameter parentheses, for example
VARCHAR( 20 ). |
public final String sessionId
Category: Lifecycle and advanced controls
Default: Supplied to the constructor.
public boolean opearateSourceToken
false makes token add/remove helpers
ignore requests and therefore disables most formatting; it is intended
for diagnostics, not as a preserve-layout mode.
Category: Lifecycle and advanced controls
Default: true.
public TAlignStyle selectColumnlistStyle
selectColumnlistComma; wrapped layout keeps items on
the current line. Alias alignment is applied only to stacked lists.
Category: SELECT list and query clauses
Default: TAlignStyle.AsStacked.
public TLinefeedsCommaOption selectColumnlistComma
selectColumnlistStyle is wrapped.
Category: SELECT list and query clauses
Default: TLinefeedsCommaOption.LfAfterComma.
public boolean selectItemInNewLine
Category: SELECT list and query clauses
Default: false.
public boolean alignAliasInSelectList
Category: SELECT list and query clauses
Default: true.
public boolean treatDistinctAsVirtualColumn
Category: SELECT list and query clauses
Default: false.
public TAlignStyle selectFromclauseStyle
Category: FROM, JOIN, and WHERE
Default: TAlignStyle.AsStacked.
public TLinefeedsCommaOption selectFromclauseComma
selectFromclauseStyle is stacked.
Category: FROM, JOIN, and WHERE
Default: TLinefeedsCommaOption.LfAfterComma.
public boolean fromClauseInNewLine
Category: FROM, JOIN, and WHERE
Default: false.
public boolean selectFromclauseJoinOnInNewline
Category: FROM, JOIN, and WHERE
Default: true.
public boolean alignJoinWithFromKeyword
selectFromclauseJoinOnInNewline for that.
Category: FROM, JOIN, and WHERE
Default: false.
public boolean andOrUnderWhere
Category: FROM, JOIN, and WHERE
Default: false.
public TAlignStyle insertColumnlistStyle
defaultCommaOption rather than the
SELECT-specific comma option.
Category: INSERT and general lists
Default: TAlignStyle.AsStacked.
public TAlignStyle insertValuelistStyle
defaultCommaOption.
Category: INSERT and general lists
Default: TAlignStyle.AsStacked.
public boolean beStyleCreatetableLeftBEOnNewline
indentLen. If list items are also placed on new
lines, they receive one additional indentation level.
Category: CREATE TABLE
Default: false.
public boolean beStyleCreatetableRightBEOnNewline
Category: CREATE TABLE
Default: false.
public boolean createtableListitemInNewLine
defaultAligntype and
defaultCommaOption.
Category: CREATE TABLE
Default: false.
public TAlignOption createtableFieldlistAlignOption
defaultAligntype is stacked.
Category: CREATE TABLE
Default: TAlignOption.AloLeft.
public TLinefeedsCommaOption defaultCommaOption
Category: INSERT and general lists
Default: TLinefeedsCommaOption.LfAfterComma.
public TAlignStyle defaultAligntype
defaultCommaOption for commas.
Category: INSERT and general lists
Default: TAlignStyle.AsStacked.
public Integer indentLen
Category: Indentation and procedural blocks
Default: 2.
public Boolean useTab
tabSize; this option
does not replace all indentation characters with literal tab characters.
Category: Indentation and procedural blocks
Default: false.
public Integer tabSize
useTab is enabled. Use a positive value.
Category: Indentation and procedural blocks
Default: 2.
public Integer beStyleFunctionBodyIndent
beStyleBlockIndentSize and indentLen for effective body
indentation.
Category: Indentation and procedural blocks
Default: 2; currently has no effect.
public Boolean beStyleBlockLeftBEOnNewline
Category: Indentation and procedural blocks
Default: true.
public Integer beStyleBlockLeftBEIndentSize
beStyleBlockLeftBEOnNewline is true.
Category: Indentation and procedural blocks
Default: 2.
public Integer beStyleBlockRightBEIndentSize
Category: Indentation and procedural blocks
Default: 2.
public Integer beStyleBlockIndentSize
Category: Indentation and procedural blocks
Default: 2.
public Integer beStyleIfElseSingleStmtIndentSize
Category: Indentation and procedural blocks
Default: 2.
public Boolean caseWhenThenInSameLine
indentCaseThen.
Category: CASE expressions
Default: false.
public Integer indentCaseFromSwitch
Category: CASE expressions
Default: 2.
public Integer indentCaseThen
caseWhenThenInSameLine is true.
Category: CASE expressions
Default: 0.
public TAlignOption selectKeywordsAlignOption
Category: Keyword alignment and capitalization
Default: TAlignOption.AloLeft.
public TCaseOption caseKeywords
Category: Keyword alignment and capitalization
Default: TCaseOption.CoUppercase.
public TCaseOption caseIdentifier
Category: Keyword alignment and capitalization
Default: TCaseOption.CoNoChange.
public TCaseOption caseQuotedIdentifier
Category: Keyword alignment and capitalization
Default: TCaseOption.CoNoChange.
public TCaseOption caseFuncname
Category: Keyword alignment and capitalization
Default: TCaseOption.CoInitCap.
public TCaseOption caseDatatype
Category: Keyword alignment and capitalization
Default: TCaseOption.CoUppercase.
public Boolean wsPaddingOperatorArithmetic
Category: Whitespace and parentheses
Default: true.
public Boolean wsPaddingParenthesesInFunction
Category: Whitespace and parentheses
Default: false.
public Boolean wsPaddingParenthesesInExpression
( a + b ). Subqueries, function calls, and datatype
parameters use separate options.
Category: Whitespace and parentheses
Default: true.
public Boolean wsPaddingParenthesesOfSubQuery
Category: Whitespace and parentheses
Default: false.
public Boolean wsPaddingParenthesesInFunctionCall
wsPaddingParenthesesInFunction instead.
Category: Whitespace and parentheses
Default: false.
public Boolean wsPaddingParenthesesOfTypename
VARCHAR( 20 ). It applies only when the parser classifies the node
as a type name.
Category: Whitespace and parentheses
Default: false.
public Boolean cteNewlineBeforeAs
Category: CTEs and declarations
Default: true.
public Boolean linebreakAfterDeclare
Category: CTEs and declarations
Default: false.
public TAlignStyle parametersStyle
Category: Routine declarations and EXEC
Default: TAlignStyle.AsStacked.
public TLinefeedsCommaOption parametersComma
parametersStyle is stacked.
Category: Routine declarations and EXEC
Default: TLinefeedsCommaOption.LfAfterComma.
public Boolean beStyleFunctionLeftBEOnNewline
Category: Routine declarations and EXEC
Default: false.
public Integer beStyleFunctionLeftBEIndentSize
beStyleFunctionLeftBEOnNewline is true.
Category: Routine declarations and EXEC
Default: 0.
public Boolean beStyleFunctionRightBEOnNewline
Category: Routine declarations and EXEC
Default: true.
public Integer beStyleFunctionRightBEIndentSize
beStyleFunctionRightBEOnNewline is true.
Category: Routine declarations and EXEC
Default: 0.
public Boolean beStyleFunctionFirstParamInNewline
Category: Routine declarations and EXEC
Default: false.
public Boolean linebreakBeforeParamInExec
indentLen from the statement. It does not control stored-routine
declaration parameters.
Category: Routine declarations and EXEC
Default: true.
public TEmptyLinesOption emptyLines
Category: Blank lines and batches
Default: TEmptyLinesOption.EloMergeIntoOne.
public Boolean insertBlankLineInBatchSqls
emptyLines policy.
Category: Blank lines and batches
Default: false.
public Boolean noEmptyLinesBetweenMultiSetStmts
Category: Blank lines and batches
Default: false.
public Boolean linenumberEnabled
Category: Line numbers
Default: false.
public Boolean linenumberZeroBased
linenumberEnabled is enabled.
Category: Line numbers
Default: false (one-based numbering).
public Integer linenumberLeftMargin
linenumberEnabled is enabled.
Category: Line numbers
Default: 0.
public Integer linenumberRightMargin
linenumberEnabled is enabled.
Category: Line numbers
Default: 2.
public TAlignStyle functionCallParametersStyle
Category: Function calls
Default: TAlignStyle.AsWrapped.
public TLinefeedsCommaOption functionCallParametersComma
functionCallParametersStyle is wrapped.
Category: Function calls
Default: TLinefeedsCommaOption.LfAfterComma.
public Boolean removeComment
/*+
are preserved. Because removal mutates the parser's token list, use a fresh
parser if the original comments are needed later.
Category: Comments, compact mode, and wrapping
Default: false.
public TCompactMode compactMode
Cpmugly
short-circuits statement-specific layout, normalizes the token stream, and
wraps only when lineWidth is exceeded; most other layout options
are therefore ignored.
Category: Comments, compact mode, and wrapping
Default: TCompactMode.CpmNone.
public Integer lineWidth
Category: Comments, compact mode, and wrapping
Default: 99.
public Integer maxSelectListColumn
lineWidth (a comment ends the line, and an item that
spans lines gets a line of its own) and alias alignment is skipped; use
Integer.MAX_VALUE to disable the threshold.
Category: Comments, compact mode, and wrapping
Default: 20. This option is available only in GSP Java.
public GOutputFmt outputFmt
GOutputFmt.ofSql and GOutputFmt.ofhtml;
GOutputFmt.ofUnknown falls back to SQL, while the other legacy enum
values currently throw UnsupportedOperationException. After HTML
output initializes the static renderer, later FormatterFactory.pp
calls reuse it until FormatterFactory.setOutputConfig(null) is
called.
Category: Output rendering
Default: GOutputFmt.ofSql.
GOutputFmtpublic String tabHtmlString