Package org.bson.json
Class JsonWriterSettings.Builder
- java.lang.Object
-
- org.bson.json.JsonWriterSettings.Builder
-
- Enclosing class:
- JsonWriterSettings
public static final class JsonWriterSettings.Builder extends Object
A builder for JsonWriterSettings- Since:
- 3.5
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JsonWriterSettings.BuilderbinaryConverter(Converter<BsonBinary> binaryConverter)Sets the converter from BSON Binary values to JSON.JsonWriterSettings.BuilderbooleanConverter(Converter<Boolean> booleanConverter)Sets the converter from BSON Boolean values to JSON.JsonWriterSettingsbuild()Build a JsonWriterSettings instance.JsonWriterSettings.BuilderdateTimeConverter(Converter<Long> dateTimeConverter)Sets the converter from BSON DateTime values to JSON.JsonWriterSettings.Builderdecimal128Converter(Converter<Decimal128> decimal128Converter)Sets the converter from BSON Decimal128 values to JSON.JsonWriterSettings.BuilderdoubleConverter(Converter<Double> doubleConverter)Sets the converter from BSON Double values to JSON.JsonWriterSettings.Builderindent(boolean indent)Sets whether indentation is enabled, which defaults to false.JsonWriterSettings.BuilderindentCharacters(String indentCharacters)Sets the indent character string to use when indentation is enabled, which defaults to two spaces.JsonWriterSettings.Builderint32Converter(Converter<Integer> int32Converter)Sets the converter from BSON Int32 values to JSON.JsonWriterSettings.Builderint64Converter(Converter<Long> int64Converter)Sets the converter from BSON Int64 values to JSON.JsonWriterSettings.BuilderjavaScriptConverter(Converter<String> javaScriptConverter)Sets the converter from BSON JavaScript values to JSON.JsonWriterSettings.BuildermaxKeyConverter(Converter<BsonMaxKey> maxKeyConverter)Sets the converter from BSON MaxKey values to JSON.JsonWriterSettings.BuildermaxLength(int maxLength)Sets the maximum length of the JSON string.JsonWriterSettings.BuilderminKeyConverter(Converter<BsonMinKey> minKeyConverter)Sets the converter from BSON MinKey values to JSON.JsonWriterSettings.BuildernewLineCharacters(String newLineCharacters)Sets the new line character string to use when indentation is enabled, which defaults toSystem.getProperty("line.separator").JsonWriterSettings.BuildernullConverter(Converter<BsonNull> nullConverter)Sets the converter from BSON Null values to JSON.JsonWriterSettings.BuilderobjectIdConverter(Converter<ObjectId> objectIdConverter)Sets the converter from BSON ObjectId values to JSON.JsonWriterSettings.BuilderoutputMode(JsonMode outputMode)Sets the output mode, which defaults toJsonMode.RELAXED.JsonWriterSettings.BuilderregularExpressionConverter(Converter<BsonRegularExpression> regularExpressionConverter)Sets the converter from BSON Regular Expression values to JSON.JsonWriterSettings.BuilderstringConverter(Converter<String> stringConverter)Sets the converter from BSON String values to JSON.JsonWriterSettings.BuildersymbolConverter(Converter<String> symbolConverter)Sets the converter from BSON Symbol values to JSON.JsonWriterSettings.BuildertimestampConverter(Converter<BsonTimestamp> timestampConverter)Sets the converter from BSON Timestamp values to JSON.JsonWriterSettings.BuilderundefinedConverter(Converter<BsonUndefined> undefinedConverter)Sets the converter from BSON Undefined values to JSON.
-
-
-
Method Detail
-
build
public JsonWriterSettings build()
Build a JsonWriterSettings instance.- Returns:
- a JsonWriterSettings instance
-
indent
public JsonWriterSettings.Builder indent(boolean indent)
Sets whether indentation is enabled, which defaults to false.- Parameters:
indent- whether indentation is enabled- Returns:
- this
-
newLineCharacters
public JsonWriterSettings.Builder newLineCharacters(String 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
public JsonWriterSettings.Builder indentCharacters(String 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
public JsonWriterSettings.Builder outputMode(JsonMode outputMode)
Sets the output mode, which defaults toJsonMode.RELAXED.- Parameters:
outputMode- the non-null output mode- Returns:
- this
-
maxLength
public JsonWriterSettings.Builder maxLength(int 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
public JsonWriterSettings.Builder nullConverter(Converter<BsonNull> nullConverter)
Sets the converter from BSON Null values to JSON.- Parameters:
nullConverter- the converter- Returns:
- this
-
stringConverter
public JsonWriterSettings.Builder stringConverter(Converter<String> stringConverter)
Sets the converter from BSON String values to JSON.- Parameters:
stringConverter- the converter- Returns:
- this
-
dateTimeConverter
public JsonWriterSettings.Builder dateTimeConverter(Converter<Long> dateTimeConverter)
Sets the converter from BSON DateTime values to JSON.- Parameters:
dateTimeConverter- the converter- Returns:
- this
-
binaryConverter
public JsonWriterSettings.Builder binaryConverter(Converter<BsonBinary> binaryConverter)
Sets the converter from BSON Binary values to JSON.- Parameters:
binaryConverter- the converter- Returns:
- this
-
booleanConverter
public JsonWriterSettings.Builder booleanConverter(Converter<Boolean> booleanConverter)
Sets the converter from BSON Boolean values to JSON.- Parameters:
booleanConverter- the converter- Returns:
- this
-
doubleConverter
public JsonWriterSettings.Builder doubleConverter(Converter<Double> doubleConverter)
Sets the converter from BSON Double values to JSON.- Parameters:
doubleConverter- the converter- Returns:
- this
-
int32Converter
public JsonWriterSettings.Builder int32Converter(Converter<Integer> int32Converter)
Sets the converter from BSON Int32 values to JSON.- Parameters:
int32Converter- the converter- Returns:
- this
-
int64Converter
public JsonWriterSettings.Builder int64Converter(Converter<Long> int64Converter)
Sets the converter from BSON Int64 values to JSON.- Parameters:
int64Converter- the converter- Returns:
- this
-
decimal128Converter
public JsonWriterSettings.Builder decimal128Converter(Converter<Decimal128> decimal128Converter)
Sets the converter from BSON Decimal128 values to JSON.- Parameters:
decimal128Converter- the converter- Returns:
- this
-
objectIdConverter
public JsonWriterSettings.Builder objectIdConverter(Converter<ObjectId> objectIdConverter)
Sets the converter from BSON ObjectId values to JSON.- Parameters:
objectIdConverter- the converter- Returns:
- this
-
timestampConverter
public JsonWriterSettings.Builder timestampConverter(Converter<BsonTimestamp> 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
public JsonWriterSettings.Builder symbolConverter(Converter<String> symbolConverter)
Sets the converter from BSON Symbol values to JSON.- Parameters:
symbolConverter- the converter- Returns:
- this
-
minKeyConverter
public JsonWriterSettings.Builder minKeyConverter(Converter<BsonMinKey> minKeyConverter)
Sets the converter from BSON MinKey values to JSON.- Parameters:
minKeyConverter- the converter- Returns:
- this
-
maxKeyConverter
public JsonWriterSettings.Builder maxKeyConverter(Converter<BsonMaxKey> maxKeyConverter)
Sets the converter from BSON MaxKey values to JSON.- Parameters:
maxKeyConverter- the converter- Returns:
- this
-
undefinedConverter
public JsonWriterSettings.Builder undefinedConverter(Converter<BsonUndefined> undefinedConverter)
Sets the converter from BSON Undefined values to JSON.- Parameters:
undefinedConverter- the converter- Returns:
- this
-
javaScriptConverter
public JsonWriterSettings.Builder javaScriptConverter(Converter<String> javaScriptConverter)
Sets the converter from BSON JavaScript values to JSON.- Parameters:
javaScriptConverter- the converter- Returns:
- this
-
-