Annotation Interface SerializerConfig
Serializer, OutputStreamSerializer, and WriterSerializer.
 Used primarily for specifying bean configuration properties on REST classes and methods.
See Also:
- 
Optional Element SummaryOptional ElementsModifier and TypeOptional ElementDescriptionAdd"_type" properties when needed.Add type attribute to root nodes.Binary output format.Automatically detect POJO recursions.File charset.Ignore recursion errors.Initial depth.Don't trim null bean property values.Class<? extends SerializerListener>Serializer listener.Max traversal depth.Maximum indentation.Quote character.intOptional rank for this config.Sort arrays and collections alphabetically.Sort maps alphabetically.Output stream charset.Trim empty lists and arrays.Trim empty maps.Trim strings.URI context bean.URI relativity.URI resolution.Use whitespace.
- 
Element Details- 
rankint rankOptional rank for this config.Can be used to override default ordering and application of config annotations. - Returns:
- The annotation value.
 - Default:
- 0
 
- 
binaryFormatBinary output format.When using the Serializer.serializeToString(Object)method on stream-based serializers, this defines the format to use when converting the resulting byte array to a string.- "SPACED_HEX" 
- "HEX" (default)
- "BASE64" 
 Notes:- 
      Supports VarResolver.DEFAULT (e.g. "$C{myConfigVar}" ).
 See Also:- Returns:
- The annotation value.
 - Default:
- ""
 
- 
addBeanTypesAdd"_type" properties when needed.If "true" , then"_type" properties will be added to beans if their type cannot be inferred through reflection.This is used to recreate the correct objects during parsing if the object types cannot be inferred. 
 For example, when serializing aMap<String,Object> field where the bean class cannot be determined from the type of the values.Note the differences between the following settings: - Serializer.Builder.addRootType()- Affects whether- '_type' is added to root node.
- Serializer.Builder.addBeanTypes()- Affects whether- '_type' is added to any nodes.
 - "true" 
- "false" (default)
 Notes:- 
      Supports VarResolver.DEFAULT (e.g. "$C{myConfigVar}" ).
 See Also:- Returns:
- The annotation value.
 - Default:
- ""
 
- 
addRootTypeAdd type attribute to root nodes.When disabled, it is assumed that the parser knows the exact Java POJO type being parsed, and therefore top-level type information that might normally be included to determine the data type will not be serialized. For example, when serializing a top-level POJO with a @Bean(typeName)value, a'_type' attribute will only be added when this setting is enabled.Note the differences between the following settings: - Serializer.Builder.addRootType()- Affects whether- '_type' is added to root node.
- Serializer.Builder.addBeanTypes()- Affects whether- '_type' is added to any nodes.
 - "true" 
- "false" (default)
 Notes:- 
      Supports VarResolver.DEFAULT (e.g. "$C{myConfigVar}" ).
 See Also:- Returns:
- The annotation value.
 - Default:
- ""
 
- 
keepNullPropertiesDon't trim null bean property values.If "true" , null bean values will be serialized to the output.Note that not enabling this setting has the following effects on parsing: - 
      Map entries with null values will be lost.
 - "true" 
- "false" (default)
 Notes:- 
      Supports VarResolver.DEFAULT (e.g. "$C{myConfigVar}" ).
 See Also:- Returns:
- The annotation value.
 - Default:
- ""
 
- 
      Map entries with 
- 
listenerClass<? extends SerializerListener> listenerSerializer listener.Class used to listen for errors and warnings that occur during serialization. See Also:- Returns:
- The annotation value.
 - Default:
- org.apache.juneau.serializer.SerializerListener.Void.class
 
- 
sortCollectionsSort arrays and collections alphabetically.Copies and sorts the contents of arrays and collections before serializing them. Note that this introduces a performance penalty. - "true" 
- "false" (default)
 Notes:- 
      Supports VarResolver.DEFAULT (e.g. "$C{myConfigVar}" ).
 See Also:- Returns:
- The annotation value.
 - Default:
- ""
 
- 
sortMapsSort maps alphabetically.Copies and sorts the contents of maps by their keys before serializing them. Note that this introduces a performance penalty. - "true" 
- "false" (default)
 Notes:- 
      Supports VarResolver.DEFAULT (e.g. "$C{myConfigVar}" ).
 See Also:- Returns:
- The annotation value.
 - Default:
- ""
 
- 
trimEmptyCollectionsTrim empty lists and arrays.If "true" , empty lists and arrays will not be serialized.Note that enabling this setting has the following effects on parsing: - Map entries with empty list values will be lost.
- Bean properties with empty list values will not be set.
 - "true" 
- "false" (default)
 Notes:- 
      Supports VarResolver.DEFAULT (e.g. "$C{myConfigVar}" ).
 See Also:- Returns:
- The annotation value.
 - Default:
- ""
 
- 
trimEmptyMapsTrim empty maps.If "true" , empty map values will not be serialized to the output.Note that enabling this setting has the following effects on parsing: - Bean properties with empty map values will not be set.
 - "true" 
- "false" (default)
 Notes:- 
      Supports VarResolver.DEFAULT (e.g. "$C{myConfigVar}" ).
 See Also:- Returns:
- The annotation value.
 - Default:
- ""
 
- 
trimStringsTrim strings.If "true" , string values will be trimmed of whitespace usingString.trim()before being serialized.- "true" 
- "false" (default)
 Notes:- 
      Supports VarResolver.DEFAULT (e.g. "$C{myConfigVar}" ).
 See Also:- Returns:
- The annotation value.
 - Default:
- ""
 
- 
uriContextURI context bean.Description:Bean used for resolution of URIs to absolute or root-relative form. Notes:- 
      Format: JSON object representing a UriContext
- 
      Supports VarResolver.DEFAULT (e.g. "$C{myConfigVar}" ).
 See Also:- Returns:
- The annotation value.
 - Default:
- ""
 
- 
      Format: JSON object representing a 
- 
uriRelativityURI relativity.Defines what relative URIs are relative to when serializing any of the following: - "RESOURCE" (default) - Relative URIs should be considered relative to the servlet URI.
- "PATH_INFO" - Relative URIs should be considered relative to the request URI.
 Notes:- 
      Supports VarResolver.DEFAULT (e.g. "$C{myConfigVar}" ).
 See Also:- Returns:
- The annotation value.
 - Default:
- ""
 
- 
uriResolutionURI resolution.Defines the resolution level for URIs when serializing any of the following: - "ABSOLUTE" - Resolve to an absolute URL (e.g.- "http://host:port/context-root/servlet-path/path-info" ).
- "ROOT_RELATIVE" - Resolve to a root-relative URL (e.g.- "/context-root/servlet-path/path-info" ).
- "NONE" (default) - Don't do any URL resolution.
 Notes:- 
      Supports VarResolver.DEFAULT (e.g. "$C{myConfigVar}" ).
 See Also:- Returns:
- The annotation value.
 - Default:
- ""
 
- 
fileCharsetFile charset.The character set to use for writing Files to the file system. Used when passing in files to Serializer.serialize(Object, Object).Notes:- Format: string
- "DEFAULT" can be used to indicate the JVM default file system charset.
- Default: JVM system default.
- 
      Supports VarResolver.DEFAULT (e.g. "$C{myConfigVar}" ).
- This setting does not apply to the RDF serializers.
 See Also:- Returns:
- The annotation value.
 - Default:
- ""
 
- 
maxIndentMaximum indentation.Specifies the maximum indentation level in the serialized document. Notes:- Format: integer
- Default: 100
- 
      Supports VarResolver.DEFAULT (e.g. "$C{myConfigVar}" ).
- This setting does not apply to the RDF serializers.
 See Also:- Returns:
- The annotation value.
 - Default:
- ""
 
- 
quoteCharQuote character.This is the character used for quoting attributes and values. Notes:- 
      Default: " 
- 
      Supports VarResolver.DEFAULT (e.g. "$C{myConfigVar}" ).
- This setting does not apply to the RDF serializers.
 See Also:- Returns:
- The annotation value.
 - Default:
- ""
 
- 
      Default: 
- 
streamCharsetOutput stream charset.The character set to use when writing to OutputStreams. Used when passing in output streams and byte arrays to Serializer.serialize(Object, Object).Notes:- Format: string
- 
      Default: "utf-8" .
- 
      Supports VarResolver.DEFAULT (e.g. "$C{myConfigVar}" ).
- This setting does not apply to the RDF serializers.
 See Also:- Returns:
- The annotation value.
 - Default:
- ""
 
- 
useWhitespaceUse whitespace.If "true" , whitespace is added to the output to improve readability.- "true" 
- "false" (default)
 Notes:- 
      Supports VarResolver.DEFAULT (e.g. "$C{myConfigVar}" ).
 See Also:- Returns:
- The annotation value.
 - Default:
- ""
 
- 
detectRecursionsAutomatically detect POJO recursions.Specifies that recursions should be checked for during traversal. Recursions can occur when traversing models that aren't true trees but rather contain loops. 
 In general, unchecked recursions cause stack-overflow-errors.
 These show up asParseExceptionswith the message"Depth too deep. Stack overflow occurred." .The behavior when recursions are detected depends on the value for BeanTraverseContext.Builder.ignoreRecursions().For example, if a model contains the links A->B->C->A, then the JSON generated will look like the following when BEANTRAVERSE_ignoreRecursions istrue ...{A:{B:{C: null }}}- "true" 
- "false" (default)
 Notes:- Checking for recursion can cause a small performance penalty.
- 
      Supports VarResolver.DEFAULT (e.g. "$C{myConfigVar}" ).
 See Also:- Returns:
- The annotation value.
 - Default:
- ""
 
- 
ignoreRecursionsIgnore recursion errors.Used in conjunction with BeanTraverseContext.Builder.detectRecursions().
 Setting is ignored ifBEANTRAVERSE_detectRecursions is"false" .If "true" , when we encounter the same object when traversing a tree, we set the value tonull .
 Otherwise, aBeanRecursionExceptionis thrown with the message"Recursion occurred, stack=..." .- "true" 
- "false" (default)
 Notes:- 
      Supports VarResolver.DEFAULT (e.g. "$C{myConfigVar}" ).
 See Also:- Returns:
- The annotation value.
 - Default:
- ""
 
- 
initialDepthInitial depth.The initial indentation level at the root. 
 Useful when constructing document fragments that need to be indented at a certain level.Notes:- Format: integer
- 
      Default value: "0" 
- 
      Supports VarResolver.DEFAULT (e.g. "$C{myConfigVar}" ).
 See Also:- Returns:
- The annotation value.
 - Default:
- ""
 
- 
maxDepthMax traversal depth.Abort traversal if specified depth is reached in the POJO tree. 
 If this depth is exceeded, an exception is thrown.Notes:- Format: integer
- 
      Default value: "100" 
- 
      Supports VarResolver.DEFAULT (e.g. "$C{myConfigVar}" ).
 See Also:- Returns:
- The annotation value.
 - Default:
- ""
 
 
-