- java.lang.Object
-
- at.syntaxerror.json5.JSONOptions
-
public class JSONOptions extends java.lang.ObjectThis class used is used to customize the behaviour ofparsingandstringifying- Since:
- 1.1.0
- Author:
- SyntaxError404
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classJSONOptions.JSONOptionsBuilder
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static JSONOptions.JSONOptionsBuilderbuilder()static @NonNull JSONOptionsgetDefaultOptions()Returns the default options for parsing and stringifyingbooleanisAllowInfinity()Whether or notInfinityshould be allowed as a number.booleanisAllowInvalidSurrogates()Whether or not invalid unicode surrogate pairs should be allowedbooleanisAllowNaN()Whether or notNaNshould be allowed as a numberbooleanisParseInstants()Whether or not instants should be parsed as such.booleanisParseStringInstants()Whether or not string instants (according to RFC 3339, Section 5.6) should be parsed as such.booleanisParseUnixInstants()Whether or not unix instants (integers) should be parsed as such.booleanisQuoteSingle()Whether or not string should be single-quoted (') instead of double-quoted (").booleanisStringifyUnixInstants()Whether or not instants should be stringifyed as unix timestamps.static voidsetDefaultOptions(@NonNull JSONOptions defaultOptions)Sets the default options for parsing and stringifying.JSONOptions.JSONOptionsBuildertoBuilder()
-
-
-
Method Detail
-
builder
public static JSONOptions.JSONOptionsBuilder builder()
-
toBuilder
public JSONOptions.JSONOptionsBuilder toBuilder()
-
isParseInstants
public boolean isParseInstants()
Whether or not instants should be parsed as such. If this isfalse,isParseStringInstants()andisParseUnixInstants()are ignoredDefault:
trueThis is a
Parser-only option- Returns:
- whether or not instants should be parsed
- Since:
- 1.1.0
-
isParseStringInstants
public boolean isParseStringInstants()
Whether or not string instants (according to RFC 3339, Section 5.6) should be parsed as such. Ignored ifisParseInstants()isfalseDefault:
trueThis is a
Parser-only option- Returns:
- whether or not string instants should be parsed
- Since:
- 1.1.0
-
isParseUnixInstants
public boolean isParseUnixInstants()
Whether or not unix instants (integers) should be parsed as such. Ignored ifisParseInstants()isfalseDefault:
trueThis is a
Parser-only option- Returns:
- whether or not unix instants should be parsed
- Since:
- 1.1.0
-
isStringifyUnixInstants
public boolean isStringifyUnixInstants()
Whether or not 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- Returns:
- whether or not instants should be stringifyed as unix timestamps
- Since:
- 1.1.0
-
isAllowNaN
public boolean isAllowNaN()
Whether or notNaNshould be allowed as a numberDefault:
true- Returns:
- whether or not
NaNshould be allowed - Since:
- 1.1.0
-
isAllowInfinity
public boolean isAllowInfinity()
Whether or notInfinityshould be allowed as a number. This applies to both+Infinityand-InfinityDefault:
true- Returns:
- whether or not
Infinityshould be allowed - Since:
- 1.1.0
-
isAllowInvalidSurrogates
public boolean isAllowInvalidSurrogates()
Whether or not invalid unicode surrogate pairs should be allowedDefault:
trueThis is a
Parser-only option- Returns:
- whether or not invalid unicode surrogate pairs should be allowed
- Since:
- 1.1.0
-
isQuoteSingle
public boolean isQuoteSingle()
Whether or not string should be single-quoted (') instead of double-quoted ("). This also includes aJSONObject'smember namesDefault:
falseThis is a
Stringify-only option- Returns:
- whether or not string should be single-quoted
- Since:
- 1.1.0
-
getDefaultOptions
@NonNull public static @NonNull JSONOptions getDefaultOptions()
Returns the default options for parsing and stringifying- Returns:
- the default options
- Since:
- 1.1.0
-
setDefaultOptions
public static void setDefaultOptions(@NonNull @NonNull JSONOptions defaultOptions)Sets the default options for parsing and stringifying. Must not benull- Parameters:
defaultOptions- the new default options- Since:
- 1.1.0
-
-