Class BsonParser.Builder
- Enclosing class:
- BsonParser
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBuilder()Constructor, default settings.protectedBuilder(BsonParser copyFrom) Copy constructor.protectedBuilder(BsonParser.Builder copyFrom) Copy constructor. -
Method Summary
Modifier and TypeMethodDescriptionbinaryFormat(BinaryFormat value) Binary wire format.build()Build the object.copy()Copy creator.hashKey()Returns the hashkey of this builder.maxLength(int value) The maximum allowed wire-declared length (in bytes) for BSON strings, binary payloads, and document/array size prefixes.nullKeyString(String value) The string used to representnull map keys in BSON documents.Trim parsed strings.trimStrings(boolean value) Same asParser.Builder.trimStrings()but allows you to explicitly specify the value.Methods inherited from class org.apache.juneau.marshall.parser.Parser.Builder
autoCloseStreams, autoCloseStreams, consumes, debugOutputLines, getConsumes, getNulls, listener, nulls, unbuffered, unbufferedMethods inherited from class org.apache.juneau.marshall.MarshallingContextable.Builder
activeView, annotations, beanClassVisibility, beanConstructorVisibility, beanDictionary, beanFieldVisibility, beanInterceptor, beanMapPutReturnsOldValue, beanMethodVisibility, beanProperties, beanProperties, beanProperties, beanPropertiesExcludes, beanPropertiesExcludes, beanPropertiesExcludes, beanPropertiesReadOnly, beanPropertiesReadOnly, beanPropertiesReadOnly, beanPropertiesWriteOnly, beanPropertiesWriteOnly, beanPropertiesWriteOnly, beansRequireDefaultConstructor, beansRequireSerializable, beansRequireSettersForGetters, bigNumberFormat, bitSetFormat, booleanFormat, calendarFormat, classFormat, classLoader, currencyFormat, dateFormat, debug, dictionaryOn, disableBeansRequireSomeProperties, disableDefaultViewInclusion, disableIgnoreMissingSetters, disableIgnoreTransientFields, disableIgnoreUnknownNullBeanProperties, disableInterfaceProxies, durationFormat, enumFormat, example, example, findFluentSetters, findFluentSetters, floatFormat, ignoreInvocationExceptionsOnGetters, ignoreInvocationExceptionsOnSetters, ignoreUnknownBeanProperties, ignoreUnknownEnumValues, implClass, implClasses, interfaceClass, interfaces, locale, localeFormat, marshallingContext, marshallingContext, marshallingContext, marshallingContext, mediaType, notBeanClasses, notBeanPackages, periodFormat, propertyNamer, propertyNamer, recordComponentOrder, stopClass, swap, swap, swaps, swaps, temporalFormat, timeZone, timeZoneFormat, typeName, typePropertyName, typePropertyName, unsortedProperties, unsortedProperties, useJavaBeanIntrospector, uuidFormat, validateSchema, validateSchemaMethods inherited from class org.apache.juneau.marshall.Context.Builder
annotations, apply, applyAnnotations, applyAnnotations, asSubtype, build, cache, canApply, copyOrNull, debug, getApplied, getType, impl, isDebug, registerBuilders, self, type
-
Constructor Details
-
Builder
protected Builder()Constructor, default settings. -
Builder
Copy constructor.- Parameters:
copyFrom- The builder to copy from.
Cannot benull .
-
Builder
Copy constructor.- Parameters:
copyFrom- The bean to copy from.
Cannot benull .
-
-
Method Details
-
binaryFormat
Description copied from class:MarshallingContextable.BuilderBinary wire format.- Overrides:
binaryFormatin classMarshallingContextable.Builder<BsonParser.Builder>- Parameters:
value- The new value for this property.
Can benull (defaults toBinaryFormat.NOT_SET).- Returns:
- This object.
-
nullKeyString
The string used to representnull map keys in BSON documents.BSON document field names cannot be
null . When parsing a field with this name, it is stored withnull as the key in the target map.- Parameters:
value- The placeholder string for null keys. Default is"<NULL>" .- Returns:
- This object.
-
maxLength
The maximum allowed wire-declared length (in bytes) for BSON strings, binary payloads, and document/array size prefixes.Guards against malformed or adversarial input where a small payload declares a huge or negative length, which would otherwise trigger
OutOfMemoryErrororNegativeArraySizeException. Malformed lengths are reported as a clean parse error instead.- Parameters:
value- The maximum length in bytes. Default is 16 MiB (the conventional BSON document-size limit). Values ≤ 0 disable the cap (only the negative-length check remains).- Returns:
- This object.
-
trimStrings
Description copied from class:Parser.BuilderTrim parsed strings.When enabled, string values will be trimmed of whitespace using
String.trim()before being added to the POJO.Example:
// Create a parser with trim-strings enabled. ReaderParserparser = JsonParser .create () .trimStrings() .build();// Use it. Stringjson ="{' foo ':' bar '}" ; Map<String,String>myMap =parser .read(json , HashMap.class , String.class , String.class );// Make sure strings are parsed. assertEquals ("bar" ,myMap .get("foo" ));- Overrides:
trimStringsin classParser.Builder<BsonParser.Builder>- Returns:
- This object.
-
trimStrings
Description copied from class:Parser.BuilderSame asParser.Builder.trimStrings()but allows you to explicitly specify the value.- Overrides:
trimStringsin classParser.Builder<BsonParser.Builder>- Parameters:
value- The value for this setting.- Returns:
- This object.
-
build
Description copied from class:Context.BuilderBuild the object.- Overrides:
buildin classInputStreamParser.Builder<BsonParser.Builder>- Returns:
- The built object.
-
hashKey
Description copied from class:Context.BuilderReturns the hashkey of this builder.Used to return previously instantiated context beans that have matching hashkeys. The
HashKeyobject is suitable for use as a hashmap key of a map of context beans. A context bean is considered equivalent if theHashKey.equals(Object)method is the same.- Overrides:
hashKeyin classParser.Builder<BsonParser.Builder>- Returns:
- The hashkey of this builder.
-
copy
Description copied from class:Context.BuilderCopy creator.- Specified by:
copyin classInputStreamParser.Builder<BsonParser.Builder>- Returns:
- A new mutable copy of this builder.
-