public enum StreamReadFeature extends Enum<StreamReadFeature>
JsonParser.Feature
s.Enum Constant and Description |
---|
AUTO_CLOSE_SOURCE
Feature that determines whether parser will automatically
close underlying input source that is NOT owned by the
parser.
|
IGNORE_UNDEFINED
Feature that determines what to do if the underlying data format requires knowledge
of all properties to decode (usually via a Schema), and if no definition is
found for a property that input content contains.
|
INCLUDE_SOURCE_IN_LOCATION
Feature that determines whether
JsonLocation instances should be constructed
with reference to source or not. |
STRICT_DUPLICATE_DETECTION
Feature that determines whether
JsonParser will explicitly
check that no duplicate JSON Object field names are encountered. |
Modifier and Type | Method and Description |
---|---|
static int |
collectDefaults()
Method that calculates bit set (flags) of all features that
are enabled by default.
|
boolean |
enabledByDefault() |
boolean |
enabledIn(int flags) |
int |
getMask() |
JsonParser.Feature |
mappedFeature() |
static StreamReadFeature |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static StreamReadFeature[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final StreamReadFeature AUTO_CLOSE_SOURCE
InputStream
and Reader
instances used to create the parser. If enabled, parser
will handle closing, as long as parser itself gets closed:
this happens when end-of-input is encountered, or parser
is closed by a call to JsonParser.close()
.
Feature is enabled by default.
public static final StreamReadFeature STRICT_DUPLICATE_DETECTION
JsonParser
will explicitly
check that no duplicate JSON Object field names are encountered.
If enabled, parser will check all names within context and report
duplicates by throwing a JsonParseException
; if disabled,
parser will not do such checking. Assumption in latter case is
that caller takes care of handling duplicates at a higher level:
data-binding, for example, has features to specify detection to
be done there.
Note that enabling this feature will incur performance overhead due to having to store and check additional information: this typically adds 20-30% to execution time for basic parsing.
public static final StreamReadFeature IGNORE_UNDEFINED
Note that support for this feature is implemented by individual data format module, if (and only if) it makes sense for the format in question. For JSON, for example, this feature has no effect as properties need not be pre-defined.
Feature is disabled by default, meaning that if the underlying data format
requires knowledge of all properties to output, attempts to read an unknown
property will result in a JsonProcessingException
public static final StreamReadFeature INCLUDE_SOURCE_IN_LOCATION
JsonLocation
instances should be constructed
with reference to source or not. If source reference is included, its type and contents
are included when `toString()` method is called (most notably when printing out parse
exception with that location information). If feature is disabled, no source reference
is passed and source is only indicated as "UNKNOWN".
Most common reason for disabling this feature is to avoid leaking information about internal information; this may be done for security reasons. Note that even if source reference is included, only parts of contents are usually printed, and not the whole contents. Further, many source reference types can not necessarily access contents (like streams), so only type is indicated, not contents.
Feature is enabled by default, meaning that "source reference" information is passed
and some or all of the source content may be included in JsonLocation
information
constructed either when requested explicitly, or when needed for an exception.
public static StreamReadFeature[] values()
for (StreamReadFeature c : StreamReadFeature.values()) System.out.println(c);
public static StreamReadFeature valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic static int collectDefaults()
public boolean enabledByDefault()
public boolean enabledIn(int flags)
public int getMask()
public JsonParser.Feature mappedFeature()
Copyright © 2008–2019 FasterXML. All rights reserved.