Package org.bson.json
Class JsonWriterSettings.Builder
java.lang.Object
org.bson.json.JsonWriterSettings.Builder
- Enclosing class:
- JsonWriterSettings
A builder for JsonWriterSettings
- Since:
- 3.5
-
Method Summary
Modifier and TypeMethodDescriptionbinaryConverter
(Converter<BsonBinary> binaryConverter) Sets the converter from BSON Binary values to JSON.booleanConverter
(Converter<Boolean> booleanConverter) Sets the converter from BSON Boolean values to JSON.build()
Build a JsonWriterSettings instance.dateTimeConverter
(Converter<Long> dateTimeConverter) Sets the converter from BSON DateTime values to JSON.decimal128Converter
(Converter<Decimal128> decimal128Converter) Sets the converter from BSON Decimal128 values to JSON.doubleConverter
(Converter<Double> doubleConverter) Sets the converter from BSON Double values to JSON.indent
(boolean indent) Sets whether indentation is enabled, which defaults to false.indentCharacters
(String indentCharacters) Sets the indent character string to use when indentation is enabled, which defaults to two spaces.int32Converter
(Converter<Integer> int32Converter) Sets the converter from BSON Int32 values to JSON.int64Converter
(Converter<Long> int64Converter) Sets the converter from BSON Int64 values to JSON.javaScriptConverter
(Converter<String> javaScriptConverter) Sets the converter from BSON JavaScript values to JSON.maxKeyConverter
(Converter<BsonMaxKey> maxKeyConverter) Sets the converter from BSON MaxKey values to JSON.maxLength
(int maxLength) Sets the maximum length of the JSON string.minKeyConverter
(Converter<BsonMinKey> minKeyConverter) Sets the converter from BSON MinKey values to JSON.newLineCharacters
(String newLineCharacters) Sets the new line character string to use when indentation is enabled, which defaults toSystem.getProperty("line.separator")
.nullConverter
(Converter<BsonNull> nullConverter) Sets the converter from BSON Null values to JSON.objectIdConverter
(Converter<ObjectId> objectIdConverter) Sets the converter from BSON ObjectId values to JSON.outputMode
(JsonMode outputMode) Sets the output mode, which defaults toJsonMode.RELAXED
.regularExpressionConverter
(Converter<BsonRegularExpression> regularExpressionConverter) Sets the converter from BSON Regular Expression values to JSON.stringConverter
(Converter<String> stringConverter) Sets the converter from BSON String values to JSON.symbolConverter
(Converter<String> symbolConverter) Sets the converter from BSON Symbol values to JSON.timestampConverter
(Converter<BsonTimestamp> timestampConverter) Sets the converter from BSON Timestamp values to JSON.undefinedConverter
(Converter<BsonUndefined> undefinedConverter) Sets the converter from BSON Undefined values to JSON.
-
Method Details
-
build
Build a JsonWriterSettings instance.- Returns:
- a JsonWriterSettings instance
-
indent
Sets whether indentation is enabled, which defaults to false.- Parameters:
indent
- whether indentation is enabled- Returns:
- this
-
newLineCharacters
Sets the new line character string to use when indentation is enabled, which defaults toSystem.getProperty("line.separator")
.- Parameters:
newLineCharacters
- the non-null new line character string- Returns:
- this
-
indentCharacters
Sets the indent character string to use when indentation is enabled, which defaults to two spaces.- Parameters:
indentCharacters
- the non-null indent character string- Returns:
- this
-
outputMode
Sets the output mode, which defaults toJsonMode.RELAXED
.- Parameters:
outputMode
- the non-null output mode- Returns:
- this
-
maxLength
Sets the maximum length of the JSON string. The string will be truncated at this length.- Parameters:
maxLength
- the maximum length, which must be >= 0 where 0 indicate no maximum length- Returns:
- the maximum length of the JSON string
- Since:
- 3.7
-
nullConverter
Sets the converter from BSON Null values to JSON.- Parameters:
nullConverter
- the converter- Returns:
- this
-
stringConverter
Sets the converter from BSON String values to JSON.- Parameters:
stringConverter
- the converter- Returns:
- this
-
dateTimeConverter
Sets the converter from BSON DateTime values to JSON.- Parameters:
dateTimeConverter
- the converter- Returns:
- this
-
binaryConverter
Sets the converter from BSON Binary values to JSON.- Parameters:
binaryConverter
- the converter- Returns:
- this
-
booleanConverter
Sets the converter from BSON Boolean values to JSON.- Parameters:
booleanConverter
- the converter- Returns:
- this
-
doubleConverter
Sets the converter from BSON Double values to JSON.- Parameters:
doubleConverter
- the converter- Returns:
- this
-
int32Converter
Sets the converter from BSON Int32 values to JSON.- Parameters:
int32Converter
- the converter- Returns:
- this
-
int64Converter
Sets the converter from BSON Int64 values to JSON.- Parameters:
int64Converter
- the converter- Returns:
- this
-
decimal128Converter
Sets the converter from BSON Decimal128 values to JSON.- Parameters:
decimal128Converter
- the converter- Returns:
- this
-
objectIdConverter
Sets the converter from BSON ObjectId values to JSON.- Parameters:
objectIdConverter
- the converter- Returns:
- this
-
timestampConverter
Sets the converter from BSON Timestamp values to JSON.- Parameters:
timestampConverter
- the converter- Returns:
- this
-
regularExpressionConverter
public JsonWriterSettings.Builder regularExpressionConverter(Converter<BsonRegularExpression> regularExpressionConverter) Sets the converter from BSON Regular Expression values to JSON.- Parameters:
regularExpressionConverter
- the converter- Returns:
- this
-
symbolConverter
Sets the converter from BSON Symbol values to JSON.- Parameters:
symbolConverter
- the converter- Returns:
- this
-
minKeyConverter
Sets the converter from BSON MinKey values to JSON.- Parameters:
minKeyConverter
- the converter- Returns:
- this
-
maxKeyConverter
Sets the converter from BSON MaxKey values to JSON.- Parameters:
maxKeyConverter
- the converter- Returns:
- this
-
undefinedConverter
Sets the converter from BSON Undefined values to JSON.- Parameters:
undefinedConverter
- the converter- Returns:
- this
-
javaScriptConverter
Sets the converter from BSON JavaScript values to JSON.- Parameters:
javaScriptConverter
- the converter- Returns:
- this
-