Class HjsonSerializer.Builder
- Enclosing class:
- HjsonSerializer
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBuilder()protectedBuilder(HjsonSerializer copyFrom) protectedBuilder(HjsonSerializer.Builder copyFrom) -
Method Summary
Modifier and TypeMethodDescriptionbuild()Build the object.compact()Creates compact output (comma-separated, single line).copy()Copy creator.hashKey()Returns the hashkey of this builder.omitRootBraces(boolean value) Omits root-level object braces{} in output.useMultilineStrings(boolean value) Enables multiline strings for values containing newlines.useNewlineSeparators(boolean value) Uses newlines instead of commas between object members.useQuotelessKeys(boolean value) Enables quoteless object keys when safe.useQuotelessStrings(boolean value) Enables quoteless string output when values are unambiguous.Use whitespace.useWhitespace(boolean value) Same asWriterSerializer.Builder.useWhitespace()but allows you to explicitly specify the value.ws()Use whitespace.Methods inherited from class org.apache.juneau.marshall.serializer.WriterSerializer.Builder
maxIndent, quoteChar, quoteCharOverride, sq, streamCharsetMethods inherited from class org.apache.juneau.marshall.serializer.Serializer.Builder
accept, addBeanTypes, addBeanTypes, addRootType, addRootType, getAccept, getProduces, keepNullProperties, keepNullProperties, listener, nonDefault, nonDefault, produces, sortCollections, sortCollections, sortMaps, sortMaps, trimEmptyCollections, trimEmptyCollections, trimEmptyMaps, trimEmptyMaps, trimStrings, trimStrings, uriContext, uriRelativity, uriResolutionMethods inherited from class org.apache.juneau.marshall.MarshallingTraverseContext.Builder
detectRecursions, detectRecursions, ignoreRecursions, ignoreRecursions, initialDepth, maxDepthMethods 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, binaryFormat, 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() -
Builder
-
Builder
-
-
Method Details
-
useMultilineStrings
Enables multiline strings for values containing newlines.- Parameters:
value-true to use''' blocks for newline-containing strings.- Returns:
- This object.
-
useQuotelessStrings
Enables quoteless string output when values are unambiguous.- Parameters:
value-true to emit unquoted strings when safe.- Returns:
- This object.
-
useQuotelessKeys
Enables quoteless object keys when safe.- Parameters:
value-true to emit unquoted keys when safe.- Returns:
- This object.
-
omitRootBraces
Omits root-level object braces{} in output.- Parameters:
value-true to omit root braces.- Returns:
- This object.
-
useNewlineSeparators
Uses newlines instead of commas between object members.- Parameters:
value-true for newline-separated members.- Returns:
- This object.
-
compact
Creates compact output (comma-separated, single line).- Returns:
- This object.
-
useWhitespace
Description copied from class:WriterSerializer.BuilderUse whitespace.When enabled, whitespace is added to the output to improve readability.
Example:
// Create a serializer with whitespace enabled. WriterSerializerserializer = JsonSerializer .create () .useWhitespace() .build();// A bean with a single property public class MyBean {public Stringfoo ="bar" ; }// Produces "\{\n\t"foo": "bar"\n\}\n" Stringjson =serializer .write(new MyBean());- Overrides:
useWhitespacein classWriterSerializer.Builder<HjsonSerializer.Builder>- Returns:
- This object.
-
useWhitespace
Description copied from class:WriterSerializer.BuilderSame asWriterSerializer.Builder.useWhitespace()but allows you to explicitly specify the value.- Overrides:
useWhitespacein classWriterSerializer.Builder<HjsonSerializer.Builder>- Parameters:
value- The value for this setting.- Returns:
- This object.
-
ws
Description copied from class:WriterSerializer.BuilderUse whitespace.When enabled, whitespace is added to the output to improve readability.
Example:
// Create a serializer with whitespace enabled. WriterSerializerserializer = JsonSerializer .create () .ws() .build();// A bean with a single property public class MyBean {public Stringfoo ="bar" ; }// Produces "\{\n\t"foo": "bar"\n\}\n" Stringjson =serializer .write(new MyBean());- Overrides:
wsin classWriterSerializer.Builder<HjsonSerializer.Builder>- Returns:
- This object.
-
build
Description copied from class:Context.BuilderBuild the object.- Overrides:
buildin classWriterSerializer.Builder<HjsonSerializer.Builder>- Returns:
- The built object.
-
copy
Description copied from class:Context.BuilderCopy creator.- Specified by:
copyin classWriterSerializer.Builder<HjsonSerializer.Builder>- Returns:
- A new mutable copy of this builder.
-
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 classWriterSerializer.Builder<HjsonSerializer.Builder>- Returns:
- The hashkey of this builder.
-