public static final class JsonValueParser.Builder extends Object
JsonValueParser
.Modifier and Type | Method and Description |
---|---|
JsonValueParser |
build(InputStream jsonStream)
Builds
JsonValueParser for the stringified JSON. |
JsonValueParser |
build(String json)
Builds
JsonValueParser for the stringified JSON. |
JsonValueParser.Builder |
enableSupplementalLiteralsWithNumbers()
Enables creating
JsonDouble and JsonLong instances with supplemental literal strings. |
JsonValueParser.Builder |
fallbackForUnparsableNumbers(double defaultDouble,
long defaultLong)
Enables falling back to default numbers for unparsable numbers.
|
JsonValueParser.Builder |
root(JsonPointer root)
Sets the JSON Pointer to the "root" element to parse.
|
JsonValueParser.Builder |
root(String root)
Sets the JSON Pointer to the "root" element to parse.
|
JsonValueParser.Builder |
setDepthToFlattenJsonArrays(int depthToFlattenJsonArrays)
Sets the depth to flatten JSON Arrays to parse.
|
public JsonValueParser.Builder root(JsonPointer root)
root
- the JSON Pointer to the root elementpublic JsonValueParser.Builder root(String root)
root
- the JSON Pointer to the root elementIllegalArgumentException
- if the input does not present a valid JSON Pointer expressionpublic JsonValueParser.Builder setDepthToFlattenJsonArrays(int depthToFlattenJsonArrays)
depthToFlattenJsonArrays
- the depth to flatten JSON Arrayspublic JsonValueParser.Builder enableSupplementalLiteralsWithNumbers()
JsonDouble
and JsonLong
instances with supplemental literal strings.
JsonDouble.withLiteral(double,String)
and JsonLong.withLiteral(long,String)
are
used to create JsonDouble
and JsonLong
instances if enabled. The text representations
from JsonParser
are passed as literals.
The supplemental literal strings would help with representing unparsable numbers, such as integers
larger than Long.MAX_VALUE
, but literals would consume larger object heap memory.
public JsonValueParser.Builder fallbackForUnparsableNumbers(double defaultDouble, long defaultLong)
The parser would throw an exception for unparsable numbers if falling back is not enabled.
defaultDouble
- the default for floating-point numbersdefaultLong
- the default for integral numberspublic JsonValueParser build(String json) throws IOException
JsonValueParser
for the stringified JSON.json
- the stringified JSONJsonValueParser
instance createdIOException
public JsonValueParser build(InputStream jsonStream) throws IOException
JsonValueParser
for the stringified JSON.jsonStream
- InputStream
of the stringified JSONJsonValueParser
instance createdIOException