Enum CBORParser.Feature

  • All Implemented Interfaces:
    com.fasterxml.jackson.core.FormatFeature, com.fasterxml.jackson.core.util.JacksonFeature, java.io.Serializable, java.lang.Comparable<CBORParser.Feature>
    Enclosing class:
    CBORParser

    public static enum CBORParser.Feature
    extends java.lang.Enum<CBORParser.Feature>
    implements com.fasterxml.jackson.core.FormatFeature
    Enumeration that defines all togglable features for CBOR generators.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private boolean _defaultState  
      private int _mask  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Feature​(boolean defaultState)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method 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 CBORParser.Feature valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static CBORParser.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

      • DECODE_USING_STANDARD_NEGATIVE_BIGINT_ENCODING

        public static final CBORParser.Feature DECODE_USING_STANDARD_NEGATIVE_BIGINT_ENCODING
        Feature that determines how binary tagged negative BigInteger values are decoded: either assuming CBOR standard encoding logic (as per spec), or the legacy Jackson encoding logic (encoding up to Jackson 2.19). When enabled, ensures proper encoding of negative values (e.g., [0xC3, 0x41, 0x00] is decoded as -1) When disabled, maintains backwards compatibility with existing implementations (e.g., [0xC3, 0x41, 0x00] is decoded as 0).

        Note that there is the counterpart CBORGenerator.Feature.ENCODE_USING_STANDARD_NEGATIVE_BIGINT_ENCODING for encoding.

        The default value is false for backwards compatibility.

        Since:
        2.20
      • READ_UNDEFINED_AS_EMBEDDED_OBJECT

        public static final CBORParser.Feature READ_UNDEFINED_AS_EMBEDDED_OBJECT
        Feature that determines how an undefined value (0xF7) is exposed by parser.

        When enabled, the parser returns JsonToken.VALUE_EMBEDDED_OBJECT with a value of null, allowing the caller to distinguish undefined from actual JsonToken.VALUE_NULL. When disabled undefined value is reported as JsonToken.VALUE_NULL.

        The default value is false for backwards compatibility (with versions prior to 2.20).

        Since:
        2.20
      • READ_SIMPLE_VALUE_AS_EMBEDDED_OBJECT

        public static final CBORParser.Feature READ_SIMPLE_VALUE_AS_EMBEDDED_OBJECT
        Feature that determines how a CBOR "simple value" of major type 7 is exposed by parser.

        When enabled, the parser returns JsonToken.VALUE_EMBEDDED_OBJECT with an embedded value of type CBORSimpleValue, allowing the caller to distinguish these values from actual JsonToken.VALUE_NUMBER_INTs. When disabled, simple values are returned as JsonToken.VALUE_NUMBER_INT.

        The default value is false for backwards compatibility (with versions prior to 2.20).

        Since:
        2.20
    • Field Detail

      • _defaultState

        private final boolean _defaultState
      • _mask

        private final int _mask
    • Constructor Detail

      • Feature

        private Feature​(boolean defaultState)
    • Method Detail

      • values

        public static CBORParser.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 (CBORParser.Feature c : CBORParser.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 CBORParser.Feature valueOf​(java.lang.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:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.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()
        Specified by:
        enabledByDefault in interface com.fasterxml.jackson.core.FormatFeature
        Specified by:
        enabledByDefault in interface com.fasterxml.jackson.core.util.JacksonFeature
      • getMask

        public int getMask()
        Specified by:
        getMask in interface com.fasterxml.jackson.core.FormatFeature
        Specified by:
        getMask in interface com.fasterxml.jackson.core.util.JacksonFeature
      • enabledIn

        public boolean enabledIn​(int flags)
        Specified by:
        enabledIn in interface com.fasterxml.jackson.core.FormatFeature
        Specified by:
        enabledIn in interface com.fasterxml.jackson.core.util.JacksonFeature