Package org.tomlj
Class TomlParseOptions
java.lang.Object
org.tomlj.TomlParseOptions
@DefaultQualifier(value=org.checkerframework.checker.nullness.qual.NonNull.class,
locations={RETURN,PARAMETER,FIELD})
public final class TomlParseOptions
extends Object
Options controlling how a TOML document is parsed.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe default maximum nesting depth: 128. -
Method Summary
Modifier and TypeMethodDescriptionstatic TomlParseOptionsdefaults()The default parse options:TomlVersion.LATEST, with a maximum nesting depth of 128.booleaninthashCode()intThe maximum nesting depth allowed in a parsed document.toString()version()The version level to parse at.withMaxNestingDepth(int maxNestingDepth) Create a copy of these options that allows a different maximum nesting depth.withVersion(TomlVersion version) Create a copy of these options that parses at a different specification version.
-
Field Details
-
DEFAULT_MAX_NESTING_DEPTH
public static final int DEFAULT_MAX_NESTING_DEPTHThe default maximum nesting depth: 128.- See Also:
-
-
Method Details
-
defaults
The default parse options:TomlVersion.LATEST, with a maximum nesting depth of 128.- Returns:
- The default parse options.
-
withVersion
Create a copy of these options that parses at a different specification version.- Parameters:
version- The version level to parse at.- Returns:
- A new set of options with the given version.
-
withMaxNestingDepth
Create a copy of these options that allows a different maximum nesting depth.The depth of a value, table or array is the number of tables and arrays that enclose it, not counting the root table. For example:
- In
a = [[1]]the integer1is nested 2 deep (the outer and inner arrays). - In
a.b.c = 1the integer1is nested 2 deep (tablesaandb). - The table named by
[a.b]is nested 1 deep. - Each table of
[[a.b]]is nested 2 deep (tableaand arrayb).
The limit keeps bounded the stack depth needed to parse a document and to serialize the result with
toJson()andTomlTable.toToml(). Raising it lets deeper documents parse, but such documents then need a correspondingly larger thread stack to parse and serialize; without one, they fail with aStackOverflowError.- Parameters:
maxNestingDepth- The maximum number of tables and arrays, not counting the root table, that may enclose any value, table or array in the document. Must not be negative; with0, every table and array must be empty and directly in the root table.- Returns:
- A new set of options with the given maximum nesting depth.
- Throws:
IllegalArgumentException- IfmaxNestingDepthis negative.
- In
-
version
The version level to parse at.- Returns:
- The version level to parse at.
-
maxNestingDepth
public int maxNestingDepth()The maximum nesting depth allowed in a parsed document.- Returns:
- The maximum number of tables and arrays, not counting the root table, that may enclose any value, table or array in the document.
- See Also:
-
equals
-
hashCode
public int hashCode() -
toString
-