org.codehaus.jackson

## Enum JsonParser.Feature

- java.lang.Object
- - java.lang.Enum<JsonParser.Feature>
  - - org.codehaus.jackson.JsonParser.Feature

- All Implemented Interfaces:
    Serializable, Comparable<JsonParser.Feature>
  Enclosing class:
    JsonParser

      public static enum JsonParser.Feature
      extends Enum<JsonParser.Feature>

  Enumeration that defines all togglable features for parsers.

- - ### Enum Constant Summary

    Enum Constants
    Enum Constant and Description
    `ALLOW_BACKSLASH_ESCAPING_ANY_CHARACTER` Feature that can be enabled to accept quoting of all character using backslash qooting mechanism: if not enabled, only characters that are explicitly listed by JSON specification can be thus escaped (see JSON spec for small list of these characters)
    `ALLOW_COMMENTS` Feature that determines whether parser will allow use of Java/C++ style comments (both '/'+'*' and '//' varieties) within parsed content or not.
    `ALLOW_NON_NUMERIC_NUMBERS` Feature that allows parser to recognize set of "Not-a-Number" (NaN) tokens as legal floating number values (similar to how many other data formats and programming language source code allows it).
    `ALLOW_NUMERIC_LEADING_ZEROS` Feature that determines whether parser will allow JSON integral numbers to start with additional (ignorable) zeroes (like: 000001).
    `ALLOW_SINGLE_QUOTES` Feature that determines whether parser will allow use of single quotes (apostrophe, character '\'') for quoting Strings (names and String values).
    `ALLOW_UNQUOTED_CONTROL_CHARS` Feature that determines whether parser will allow JSON Strings to contain unquoted control characters (ASCII characters with value less than 32, including tab and line feed characters) or not.
    `ALLOW_UNQUOTED_FIELD_NAMES` Feature that determines whether parser will allow use of unquoted field names (which is allowed by Javascript, but not by JSON specification).
    `AUTO_CLOSE_SOURCE` Feature that determines whether parser will automatically close underlying input source that is NOT owned by the parser.
    `CANONICALIZE_FIELD_NAMES` Feature that determines whether JSON object field names are to be canonicalized (details of how canonicalization is done then further specified by `INTERN_FIELD_NAMES`).
    `INTERN_FIELD_NAMES` Feature that determines whether JSON object field names are to be canonicalized using `String.intern()` or not: if enabled, all field names will be intern()ed (and caller can count on this being true for all such names); if disabled, no intern()ing is done.

  - ### Method Summary

    Methods
    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()`
    `static JsonParser.Feature` | `valueOf(String name)` Returns the enum constant of this type with the specified name.
    `static JsonParser.Feature[]` | `values()` Returns an array containing the constants of this enum type, in the order they are declared.

    - ### Methods inherited from class java.lang.Enum

      `clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`

    - ### Methods inherited from class java.lang.Object

      `getClass, notify, notifyAll, wait, wait, wait`

- - ### Enum Constant Detail

    - #### AUTO_CLOSE_SOURCE

          public static final JsonParser.Feature AUTO_CLOSE_SOURCE

      Feature that determines whether parser will automatically close underlying input source that is NOT owned by the parser. If disabled, calling application has to separately close the underlying `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.

    - #### ALLOW_COMMENTS

          public static final JsonParser.Feature ALLOW_COMMENTS

      Feature that determines whether parser will allow use of Java/C++ style comments (both '/'+'*' and '//' varieties) within parsed content or not.

      Since JSON specification does not mention comments as legal construct, this is a non-standard feature; however, in the wild this is extensively used. As such, feature is disabled by default for parsers and must be explicitly enabled (via factory or parser instance).

      This feature can be changed for parser instances.

    - #### ALLOW_UNQUOTED_FIELD_NAMES

          public static final JsonParser.Feature ALLOW_UNQUOTED_FIELD_NAMES

      Feature that determines whether parser will allow use of unquoted field names (which is allowed by Javascript, but not by JSON specification).

      Since JSON specification requires use of double quotes for field names, this is a non-standard feature, and as such disabled by default.

      This feature can be changed for parser instances.

      Since:
        1.2

    - #### ALLOW_SINGLE_QUOTES

          public static final JsonParser.Feature ALLOW_SINGLE_QUOTES

      Feature that determines whether parser will allow use of single quotes (apostrophe, character '\'') for quoting Strings (names and String values). If so, this is in addition to other acceptabl markers. but not by JSON specification).

      Since JSON specification requires use of double quotes for field names, this is a non-standard feature, and as such disabled by default.

      This feature can be changed for parser instances.

      Since:
        1.3

    - #### ALLOW_UNQUOTED_CONTROL_CHARS

          public static final JsonParser.Feature ALLOW_UNQUOTED_CONTROL_CHARS

      Feature that determines whether parser will allow JSON Strings to contain unquoted control characters (ASCII characters with value less than 32, including tab and line feed characters) or not. If feature is set false, an exception is thrown if such a character is encountered.

      Since JSON specification requires quoting for all control characters, this is a non-standard feature, and as such disabled by default.

      This feature can be changed for parser instances.

      Since:
        1.4

    - #### ALLOW_BACKSLASH_ESCAPING_ANY_CHARACTER

          public static final JsonParser.Feature ALLOW_BACKSLASH_ESCAPING_ANY_CHARACTER

      Feature that can be enabled to accept quoting of all character using backslash qooting mechanism: if not enabled, only characters that are explicitly listed by JSON specification can be thus escaped (see JSON spec for small list of these characters)

      Since JSON specification requires quoting for all control characters, this is a non-standard feature, and as such disabled by default.

      This feature can be changed for parser instances.

      Since:
        1.6

    - #### ALLOW_NUMERIC_LEADING_ZEROS

          public static final JsonParser.Feature ALLOW_NUMERIC_LEADING_ZEROS

      Feature that determines whether parser will allow JSON integral numbers to start with additional (ignorable) zeroes (like: 000001). If enabled, no exception is thrown, and extra nulls are silently ignored (and not included in textual representation exposed via `JsonParser.getText()`).

      Since JSON specification does not allow leading zeroes, this is a non-standard feature, and as such disabled by default.

      This feature can be changed for parser instances.

      Since:
        1.8

    - #### ALLOW_NON_NUMERIC_NUMBERS

          public static final JsonParser.Feature ALLOW_NON_NUMERIC_NUMBERS

      Feature that allows parser to recognize set of "Not-a-Number" (NaN) tokens as legal floating number values (similar to how many other data formats and programming language source code allows it). Specific subset contains values that XML Schema (see section 3.2.4.1, Lexical Representation) allows (tokens are quoted contents, not including quotes):
      - "INF" (for positive infinity), as well as alias of "Infinity"
      - "-INF" (for negative infinity), alias "-Infinity"
      - "NaN" (for other not-a-numbers, like result of division by zero)

    - #### INTERN_FIELD_NAMES

          public static final JsonParser.Feature INTERN_FIELD_NAMES

      Feature that determines whether JSON object field names are to be canonicalized using `String.intern()` or not: if enabled, all field names will be intern()ed (and caller can count on this being true for all such names); if disabled, no intern()ing is done. There may still be basic canonicalization (that is, same String will be used to represent all identical object property names for a single document).

      Note: this setting only has effect if `CANONICALIZE_FIELD_NAMES` is true -- otherwise no canonicalization of any sort is done.

      Since:
        1.3

    - #### CANONICALIZE_FIELD_NAMES

          public static final JsonParser.Feature CANONICALIZE_FIELD_NAMES

      Feature that determines whether JSON object field names are to be canonicalized (details of how canonicalization is done then further specified by `INTERN_FIELD_NAMES`).
      Since:
        1.5

  - ### Method Detail

    - #### values

          public static JsonParser.Feature[] values()

      Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:

          for (JsonParser.Feature c : JsonParser.Feature.values())
              System.out.println(c);

      Returns:
        an array containing the constants of this enum type, in the order they are declared

    - #### valueOf

          public static JsonParser.Feature valueOf(String name)

      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
        `name` - the name of the enum constant to be returned.
      Returns:
        the enum constant with the specified name
      Throws:
        `IllegalArgumentException` - if this enum type has no constant with the specified name
        `NullPointerException` - if the argument is null

    - #### collectDefaults

          public static int collectDefaults()

      Method that calculates bit set (flags) of all features that are enabled by default.

    - #### enabledByDefault

          public boolean enabledByDefault()

    - #### enabledIn

          public boolean enabledIn(int flags)

    - #### getMask

          public int getMask()