- java.lang.Object
-
- at.syntaxerror.json5.JSONOptions.JSONOptionsBuilder
-
- Enclosing class:
- JSONOptions
public static class JSONOptions.JSONOptionsBuilder extends Object
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JSONOptions.JSONOptionsBuilderallowBinaryLiterals(boolean allowBinaryLiterals)Whether binary literals (0b10101...) should be allowedJSONOptions.JSONOptionsBuilderallowCDigitSeparators(boolean allowCDigitSeparators)Whether C-style digit separators (123'456) should be allowedJSONOptions.JSONOptionsBuilderallowHexFloatingLiterals(boolean allowHexFloatingLiterals)Whether hexadecimal floating-point literals (e.g.JSONOptions.JSONOptionsBuilderallowInfinity(boolean allowInfinity)WhetherInfinityshould be allowed as a number.JSONOptions.JSONOptionsBuilderallowInvalidSurrogates(boolean allowInvalidSurrogates)Whether invalid unicode surrogate pairs should be allowedJSONOptions.JSONOptionsBuilderallowJavaDigitSeparators(boolean allowJavaDigitSeparators)Whether Java-style digit separators (123_456) should be allowedJSONOptions.JSONOptionsBuilderallowLongUnicodeEscapes(boolean allowLongUnicodeEscapes)Whether 32-bit unicode escape sequences (\U00123456) should be allowedJSONOptions.JSONOptionsBuilderallowNaN(boolean allowNaN)WhetherNaNshould be allowed as a numberJSONOptions.JSONOptionsBuilderallowOctalLiterals(boolean allowOctalLiterals)Whether octal literals (0o567...) should be allowedJSONOptionsbuild()JSONOptions.JSONOptionsBuilderduplicateBehaviour(JSONOptions.DuplicateBehavior duplicateBehaviour)Specifies the behavior when the same key is encountered multiple times within the sameJSONObjectJSONOptions.JSONOptionsBuilderquoteSingle(boolean quoteSingle)Whether strings should be single-quoted (') instead of double-quoted (").JSONOptions.JSONOptionsBuilderstringifyAscii(boolean stringifyAscii)Whether stringifying should only yield ASCII strings.JSONOptions.JSONOptionsBuilderstringifyUnixInstants(boolean stringifyUnixInstants)Whether instants should be stringifyed as unix timestamps.StringtoString()
-
-
-
Method Detail
-
stringifyUnixInstants
public JSONOptions.JSONOptionsBuilder stringifyUnixInstants(boolean stringifyUnixInstants)
Whether instants should be stringifyed as unix timestamps. If this isfalse, instants will be stringifyed as strings (according to RFC 3339, Section 5.6).Default:
falseThis is a
Stringify-only option- Parameters:
stringifyUnixInstants- a boolean- Returns:
this.- Since:
- 1.1.0
-
stringifyAscii
public JSONOptions.JSONOptionsBuilder stringifyAscii(boolean stringifyAscii)
Whether stringifying should only yield ASCII strings. All non-ASCII characters will be converted to their Unicode escape sequence (\uXXXX).Default:
falseThis is a
Stringify-only option- Parameters:
stringifyAscii- a boolean- Returns:
this.- Since:
- 2.0.0
-
allowNaN
public JSONOptions.JSONOptionsBuilder allowNaN(boolean allowNaN)
WhetherNaNshould be allowed as a numberDefault:
true- Parameters:
allowNaN- a boolean- Returns:
this.- Since:
- 1.1.0
-
allowInfinity
public JSONOptions.JSONOptionsBuilder allowInfinity(boolean allowInfinity)
WhetherInfinityshould be allowed as a number. This applies to both+Infinityand-InfinityDefault:
true- Parameters:
allowInfinity- a boolean- Returns:
this.- Since:
- 1.1.0
-
allowInvalidSurrogates
public JSONOptions.JSONOptionsBuilder allowInvalidSurrogates(boolean allowInvalidSurrogates)
Whether invalid unicode surrogate pairs should be allowedDefault:
trueThis is a
Parser-only option- Parameters:
allowInvalidSurrogates- a boolean- Returns:
this.- Since:
- 1.1.0
-
quoteSingle
public JSONOptions.JSONOptionsBuilder quoteSingle(boolean quoteSingle)
Whether strings should be single-quoted (') instead of double-quoted ("). This also includes aJSONObject'smember namesDefault:
falseThis is a
Stringify-only option- Parameters:
quoteSingle- a boolean- Returns:
this.- Since:
- 1.1.0
-
allowBinaryLiterals
public JSONOptions.JSONOptionsBuilder allowBinaryLiterals(boolean allowBinaryLiterals)
- Parameters:
allowBinaryLiterals- a boolean- Returns:
this.- Since:
- 2.0.0
-
allowOctalLiterals
public JSONOptions.JSONOptionsBuilder allowOctalLiterals(boolean allowOctalLiterals)
- Parameters:
allowOctalLiterals- a boolean- Returns:
this.- Since:
- 2.0.0
-
allowHexFloatingLiterals
public JSONOptions.JSONOptionsBuilder allowHexFloatingLiterals(boolean allowHexFloatingLiterals)
Whether hexadecimal floating-point literals (e.g.0xA.BCp+12) should be allowedDefault:
falseThis is a
Parser-only option- Parameters:
allowHexFloatingLiterals- a boolean- Returns:
this.- Since:
- 2.0.0
-
allowJavaDigitSeparators
public JSONOptions.JSONOptionsBuilder allowJavaDigitSeparators(boolean allowJavaDigitSeparators)
Whether Java-style digit separators (123_456) should be allowedDefault:
falseThis is a
Parser-only option- Parameters:
allowJavaDigitSeparators- a boolean- Returns:
this.- Since:
- 2.0.0
-
allowCDigitSeparators
public JSONOptions.JSONOptionsBuilder allowCDigitSeparators(boolean allowCDigitSeparators)
Whether C-style digit separators (123'456) should be allowedDefault:
falseThis is a
Parser-only option- Parameters:
allowCDigitSeparators- a boolean- Returns:
this.- Since:
- 2.0.0
-
allowLongUnicodeEscapes
public JSONOptions.JSONOptionsBuilder allowLongUnicodeEscapes(boolean allowLongUnicodeEscapes)
Whether 32-bit unicode escape sequences (\U00123456) should be allowedDefault:
falseThis is a
Parser-only option- Parameters:
allowLongUnicodeEscapes- a boolean- Returns:
this.- Since:
- 2.0.0
-
duplicateBehaviour
public JSONOptions.JSONOptionsBuilder duplicateBehaviour(JSONOptions.DuplicateBehavior duplicateBehaviour)
Specifies the behavior when the same key is encountered multiple times within the sameJSONObjectDefault:
UNIQUEThis is a
Parser-only option- Parameters:
duplicateBehaviour- the behavior- Returns:
this.- Since:
- 1.3.0
-
build
public JSONOptions build()
-
-