Enum Class BsonGenerator.Feature

java.lang.Object
java.lang.Enum<BsonGenerator.Feature>
de.undercouch.bson4jackson.BsonGenerator.Feature
All Implemented Interfaces:
Serializable, Comparable<BsonGenerator.Feature>, Constable
Enclosing class:
BsonGenerator

public static enum BsonGenerator.Feature extends Enum<BsonGenerator.Feature>
Defines toggable features
  • Enum Constant Details

    • ENABLE_STREAMING

      public static final BsonGenerator.Feature ENABLE_STREAMING

      Enables streaming by setting the document's total number of bytes in the header to 0. This allows the generator to flush the output buffer from time to time. Otherwise the generator would have to buffer the whole file to be able to calculate the total number of bytes.

      ATTENTION: By enabling this feature, the BSON document generated by this class will not be compatible to the specification! However, if you know what you are doing and if you know that the document will be read by a parser that ignores the total number of bytes anyway (like BsonParser or org.bson.BSONDecoder from the MongoDB Java Driver do) then this feature will be very useful.

      This feature is disabled by default.

    • WRITE_BIGDECIMALS_AS_STRINGS

      public static final BsonGenerator.Feature WRITE_BIGDECIMALS_AS_STRINGS

      Forces BigDecimals to be written as Strings. The BSON format supports IEEE 754 doubles only (64 bits). You may want to enable this feature if you want to serialize numbers that require more bits or a higher accuracy.

      This feature is disabled by default.

    • WRITE_BIGDECIMALS_AS_DECIMAL128

      public static final BsonGenerator.Feature WRITE_BIGDECIMALS_AS_DECIMAL128

      Forces BigDecimals to be written as Decimal128s. (since BSON specification 1.1).

      This feature is disabled by default.

  • Method Details

    • values

      public static BsonGenerator.Feature[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static BsonGenerator.Feature valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class has no constant with the specified name
      NullPointerException - if the argument is null
    • getMask

      public int getMask()
      Returns:
      the bit mask that identifies this feature