public final class Pp2Formatter extends Object
This class is the integration target for every slice's tests. It is
deliberately not exposed to callers — the public entry point is
FormatterFactory.pp2(...), added in slice S17 once the MVP is
shippable (plan §4.2, §7.3/S17).
On parseable SQL this formatter is pp. When the whole input
parses, Pp2Engine calls FormatterFactory.pp on the whole
document with these same options and returns pp's output byte for byte;
pp2's own renderers run only over input pp could not format. The three-rung
ladder (whole-document pp → per-region pp → pp2's renderers) is
documented on FormatterFactory.pp2(TGSqlParser, Pp2FormatOptions)
and in the gudusoft.gsqlparser.pp2 package documentation.
Since slice S16, format(...) delegates to Pp2Engine.
Before S16 it was an identity pass (Phase-0 contract, slice S4).
Lifecycle: Pp2Formatter carries no caller-visible state. Each
format(...) call is independent. Callers may share an instance
across threads (subject to their own Pp2FormatOptions discipline).
| Constructor and Description |
|---|
Pp2Formatter() |
| Modifier and Type | Method and Description |
|---|---|
Pp2FormatResult |
format(String sql)
Format the given SQL using the default vendor (
EDbVendor.dbvoracle)
and default options (Pp2FormatOptions.defaults()). |
Pp2FormatResult |
format(String sql,
EDbVendor vendor,
Pp2FormatOptions opts)
Format the given SQL using the supplied vendor and options.
|
Pp2FormatResult |
format(String sql,
Pp2FormatOptions opts)
Format the given SQL using the default vendor (
EDbVendor.dbvoracle)
and the supplied options. |
public Pp2Formatter()
public Pp2FormatResult format(String sql)
EDbVendor.dbvoracle)
and default options (Pp2FormatOptions.defaults()).NullPointerException - if sql is nullpublic Pp2FormatResult format(String sql, Pp2FormatOptions opts)
EDbVendor.dbvoracle)
and the supplied options.NullPointerException - if sql or opts is nullpublic Pp2FormatResult format(String sql, EDbVendor vendor, Pp2FormatOptions opts)
Pp2Engine.format(String, EDbVendor, Pp2FormatOptions).
sql need not parse. If it does parse as a whole, the returned
text is FormatterFactory.pp's output for it, unchanged; see the
class documentation.
NullPointerException - if any argument is null