public final class TransformPolicy extends Object
Each transformation is accepted only in its exact expected form: given the input token and the requested setting, the output token must be either unchanged or exactly the expected text. Everything a transformation does not cover is compared as before. Nothing is compared "case-insensitively" or "ignored" as a blanket rule, so a formatter that makes a different change than the one requested is still caught.
variableCase: variables (@Total, :host) may have
the requested case applied to the part after their prefix.quotedIdentifierCase: delimited names ("Name",
[Name]) may have the requested case applied inside the
delimiters.compactComments: compact mode may rewrite a line comment
-- x as /* -- x */ (with or without the space
before the closing delimiter), so it cannot swallow the rest of a
compacted line.removeComments: comments may be removed, except optimizer hints
(/*+ ... */), which must stay byte-exact and in order.Used by TokenEquivalence for pp2's guards (through
Pp2FormatOptions.transformPolicy) and by the format worker's checks,
so every layer applies the same contract.
| Modifier and Type | Field and Description |
|---|---|
static TransformPolicy |
NONE
No transformation allowed: the plain content check.
|
| Constructor and Description |
|---|
TransformPolicy(TCaseOption variableCase,
TCaseOption quotedIdentifierCase,
boolean compactComments,
boolean removeComments) |
| Modifier and Type | Method and Description |
|---|---|
TCaseOption |
getQuotedIdentifierCase() |
TCaseOption |
getVariableCase() |
boolean |
isCompactComments() |
boolean |
isNone() |
boolean |
isRemoveComments() |
String |
toString() |
public static final TransformPolicy NONE
public TransformPolicy(TCaseOption variableCase, TCaseOption quotedIdentifierCase, boolean compactComments, boolean removeComments)
variableCase - requested variable case, or nullquotedIdentifierCase - requested delimited-name case, or nullcompactComments - compact mode's line-comment rewrite allowedremoveComments - comment removal (hints kept) allowedpublic TCaseOption getVariableCase()
public TCaseOption getQuotedIdentifierCase()
public boolean isCompactComments()
public boolean isRemoveComments()
public boolean isNone()