Enum Class BsonGenerator.Feature
- All Implemented Interfaces:
Serializable,Comparable<BsonGenerator.Feature>,Constable
- Enclosing class:
- BsonGenerator
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionEnables streaming by setting the document's total number of bytes in the header to 0.ForcesBigDecimals to be written asDecimal128s.ForcesBigDecimals to be written asStrings. -
Method Summary
Modifier and TypeMethodDescriptionintgetMask()static BsonGenerator.FeatureReturns the enum constant of this class with the specified name.static BsonGenerator.Feature[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
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
BsonParserororg.bson.BSONDecoderfrom the MongoDB Java Driver do) then this feature will be very useful.This feature is disabled by default.
-
WRITE_BIGDECIMALS_AS_STRINGS
Forces
BigDecimals to be written asStrings. 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
Forces
BigDecimals to be written asDecimal128s. (since BSON specification 1.1).This feature is disabled by default.
-
-
Method Details
-
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
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 nameNullPointerException- if the argument is null
-
getMask
public int getMask()- Returns:
- the bit mask that identifies this feature
-