@Documented @Target(value={TYPE,METHOD}) @Retention(value=RUNTIME) @Inherited @PropertyStoreApply(value=SerializerConfigApply.class) public @interface SerializerConfig
Serializer
, OutputStreamSerializer
, and WriterSerializer
.
Used primarily for specifying bean configuration properties on REST classes and methods.
Modifier and Type | Optional Element and Description |
---|---|
String |
addBeanTypes
Configuration property: Add
|
String |
addRootType
Configuration property: Add type attribute to root nodes.
|
String |
binaryFormat
Configuration property: Binary output format.
|
String |
fileCharset
Configuration property: File charset.
|
Class<? extends SerializerListener> |
listener
Configuration property: Serializer listener.
|
String |
maxIndent
Configuration property: Maximum indentation.
|
String |
quoteChar
Configuration property: Quote character.
|
int |
rank
Optional rank for this config.
|
String |
sortCollections
Configuration property: Sort arrays and collections alphabetically.
|
String |
sortMaps
Configuration property: Sort maps alphabetically.
|
String |
streamCharset
Configuration property: Output stream charset.
|
String |
trimEmptyCollections
Configuration property: Trim empty lists and arrays.
|
String |
trimEmptyMaps
Configuration property: Trim empty maps.
|
String |
trimNullProperties
Configuration property: Trim null bean property values.
|
String |
trimStrings
Configuration property: Trim strings.
|
String |
uriContext
Configuration property: URI context bean.
|
String |
uriRelativity
Configuration property: URI relativity.
|
String |
uriResolution
Configuration property: URI resolution.
|
String |
useWhitespace
Configuration property: Use whitespace.
|
public abstract int rank
Can be used to override default ordering and application of config annotations.
public abstract String binaryFormat
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.
public abstract String addBeanTypes
If
This is used to recreate the correct objects during parsing if the object types cannot be inferred.
For example, when serializing a
Note the differences between the following settings:
Serializer.SERIALIZER_addRootType
- Affects whether Serializer.SERIALIZER_addBeanTypes
- Affects whether public abstract String addRootType
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
Note the differences between the following settings:
Serializer.SERIALIZER_addRootType
- Affects whether Serializer.SERIALIZER_addBeanTypes
- Affects whether public abstract Class<? extends SerializerListener> listener
Class used to listen for errors and warnings that occur during serialization.
public abstract String sortCollections
Copies and sorts the contents of arrays and collections before serializing them.
Note that this introduces a performance penalty.
public abstract String sortMaps
Copies and sorts the contents of maps by their keys before serializing them.
Note that this introduces a performance penalty.
public abstract String trimEmptyCollections
If
Note that enabling this setting has the following effects on parsing:
public abstract String trimEmptyMaps
If
Note that enabling this setting has the following effects on parsing:
public abstract String trimNullProperties
If
Note that enabling this setting has the following effects on parsing:
public abstract String trimStrings
If String.trim()
before being serialized.
public abstract String uriContext
Bean used for resolution of URIs to absolute or root-relative form.
UriContext
public abstract String uriRelativity
Defines what relative URIs are relative to when serializing any of the following:
public abstract String uriResolution
Defines the resolution level for URIs when serializing any of the following:
public abstract String fileCharset
The character set to use for writing Files to the file system.
Used when passing in files to Serializer.serialize(Object, Object)
.
public abstract String maxIndent
Specifies the maximum indentation level in the serialized document.
public abstract String quoteChar
This is the character used for quoting attributes and values.
public abstract String streamCharset
The character set to use when writing to OutputStreams.
Used when passing in output streams and byte arrays to Serializer.serialize(Object, Object)
.
public abstract String useWhitespace
If
Copyright © 2016–2019 The Apache Software Foundation. All rights reserved.