@PublicApi public class ParserOptions extends java.lang.Object
Parser
behaves.Modifier and Type | Class and Description |
---|---|
static class |
ParserOptions.Builder |
Modifier and Type | Field and Description |
---|---|
static int |
MAX_QUERY_TOKENS
A graphql hacking vector is to send nonsensical queries that burn lots of parsing CPU time and burn
memory representing a document that won't ever execute.
|
static int |
MAX_WHITESPACE_TOKENS
Another graphql hacking vector is to send large amounts of whitespace in operations that burn lots of parsing CPU time and burn
memory representing a document.
|
Modifier and Type | Method and Description |
---|---|
static ParserOptions |
getDefaultOperationParserOptions()
By default, for operation parsing, the Parser will not capture ignored characters, and it will not capture line comments into AST
elements .
|
static ParserOptions |
getDefaultParserOptions()
By default, the Parser will not capture ignored characters.
|
static ParserOptions |
getDefaultSdlParserOptions()
By default, for SDL parsing, the Parser will not capture ignored characters, but it will capture line comments into AST
elements.
|
int |
getMaxTokens()
A graphql hacking vector is to send nonsensical queries that burn lots of parsing CPU time and burns
memory representing a document that won't ever execute.
|
int |
getMaxWhitespaceTokens()
A graphql hacking vector is to send larges amounts of whitespace that burn lots of parsing CPU time and burn
memory representing a document.
|
boolean |
isCaptureIgnoredChars()
Significant memory savings can be made if we do NOT capture ignored characters,
especially in SDL parsing.
|
boolean |
isCaptureLineComments()
Single-line
Comment s do not have any semantic meaning in
GraphQL source documents, as such you may wish to ignore them. |
boolean |
isCaptureSourceLocation()
Memory savings can be made if we do NOT set
SourceLocation s
on AST nodes, especially in SDL parsing. |
static ParserOptions.Builder |
newParserOptions() |
static void |
setDefaultOperationParserOptions(ParserOptions options)
By default, the Parser will not capture ignored characters or line comments.
|
static void |
setDefaultParserOptions(ParserOptions options)
By default, the Parser will not capture ignored characters.
|
static void |
setDefaultSdlParserOptions(ParserOptions options)
By default, for SDL parsing, the Parser will not capture ignored characters, but it will capture line comments into AST
elements .
|
ParserOptions |
transform(java.util.function.Consumer<ParserOptions.Builder> builderConsumer) |
public static final int MAX_QUERY_TOKENS
setDefaultParserOptions(ParserOptions)
allows you to change this
JVM wide.public static final int MAX_WHITESPACE_TOKENS
setDefaultParserOptions(ParserOptions)
allows you to change this
JVM wide.public static ParserOptions getDefaultParserOptions()
IgnoredChar
,
SourceLocation
public static void setDefaultParserOptions(ParserOptions options)
options
- - the new default JVM parser optionsIgnoredChar
,
SourceLocation
public static ParserOptions getDefaultOperationParserOptions()
IgnoredChar
,
SourceLocation
public static void setDefaultOperationParserOptions(ParserOptions options)
options
- - the new default JVM parser options for operation parsingIgnoredChar
,
SourceLocation
public static ParserOptions getDefaultSdlParserOptions()
IgnoredChar
,
SourceLocation
,
SchemaParser
public static void setDefaultSdlParserOptions(ParserOptions options)
options
- - the new default JVM parser options for operation parsingIgnoredChar
,
SourceLocation
public boolean isCaptureIgnoredChars()
public boolean isCaptureSourceLocation()
SourceLocation
s
on AST nodes, especially in SDL parsing.SourceLocation
s should be captured as AST nodesSourceLocation
public boolean isCaptureLineComments()
Comment
s do not have any semantic meaning in
GraphQL source documents, as such you may wish to ignore them.
This option does not ignore documentation Description
s.
Comment
s should be captured as AST nodesSourceLocation
public int getMaxTokens()
public int getMaxWhitespaceTokens()
public ParserOptions transform(java.util.function.Consumer<ParserOptions.Builder> builderConsumer)
public static ParserOptions.Builder newParserOptions()