Class JsonDataFormat.Builder
java.lang.Object
org.apache.camel.model.dataformat.JsonDataFormat.Builder
- All Implemented Interfaces:
DataFormatBuilder<JsonDataFormat>
- Enclosing class:
- JsonDataFormat
public static class JsonDataFormat.Builder
extends Object
implements DataFormatBuilder<JsonDataFormat>
Builder
is a specific builder for JsonDataFormat
.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionallowJmsType
(boolean allowJmsType) Used for JMS users to allow the JMSType header from the JMS spec to specify a FQN classname to use to unmarshal to.allowJmsType
(String allowJmsType) Used for JMS users to allow the JMSType header from the JMS spec to specify a FQN classname to use to unmarshal to.allowUnmarshallType
(boolean allowUnmarshallType) If enabled then Jackson is allowed to attempt to use the CamelJacksonUnmarshalType header during the unmarshalling.allowUnmarshallType
(String allowUnmarshallType) If enabled then Jackson is allowed to attempt to use the CamelJacksonUnmarshalType header during the unmarshalling.autoDiscoverObjectMapper
(boolean autoDiscoverObjectMapper) If set to true then Jackson will look for an objectMapper to use from the registryautoDiscoverObjectMapper
(String autoDiscoverObjectMapper) If set to true then Jackson will look for an objectMapper to use from the registryautoDiscoverSchemaResolver
(boolean autoDiscoverSchemaResolver) When not disabled, the SchemaResolver will be looked up into the registryautoDiscoverSchemaResolver
(String autoDiscoverSchemaResolver) When not disabled, the SchemaResolver will be looked up into the registrycollectionType
(Class<?> collectionType) collectionTypeName
(String collectionTypeName) Refers to a custom collection type to lookup in the registry to use.contentTypeHeader
(boolean contentTypeHeader) Whether the data format should set the Content-Type header with the type from the data format.contentTypeHeader
(String contentTypeHeader) Whether the data format should set the Content-Type header with the type from the data format.dateFormatPattern
(String dateFormatPattern) To configure the date format while marshall or unmarshall Date fields in JSON using Gson.disableFeatures
(String disableFeatures) Set of features to disable on the Jackson com.fasterxml.jackson.databind.ObjectMapper.enableFeatures
(String enableFeatures) Set of features to enable on the Jackson com.fasterxml.jackson.databind.ObjectMapper.end()
Ends the build of the data format.If you want to marshal a pojo to JSON, and the pojo has some fields with null values.When marshalling a POJO to JSON you might want to exclude certain fields from the JSON output.jsonViewTypeName
(String jsonViewTypeName) When marshalling a POJO to JSON you might want to exclude certain fields from the JSON output.library
(JsonLibrary library) Which json library to use.moduleClassNames
(String moduleClassNames) To use custom Jackson modules com.fasterxml.jackson.databind.Module specified as a String with FQN class names.moduleRefs
(String moduleRefs) To use custom Jackson modules referred from the Camel registry.namingStrategy
(String namingStrategy) If set then Jackson will use the the defined Property Naming Strategy.objectMapper
(String objectMapper) Lookup and use the existing ObjectMapper with the given id when using Jackson.prettyPrint
(boolean prettyPrint) To enable pretty printing output nicely formatted.prettyPrint
(String prettyPrint) To enable pretty printing output nicely formatted.schemaResolver
(String schemaResolver) Optional schema resolver used to lookup schemas for the data in transit.If set then Jackson will use the Timezone when marshalling/unmarshalling.unmarshalType
(Class<?> unmarshalType) Class of the java type to use when unmarshallingunmarshalTypeName
(String unmarshalTypeName) Class name of the java type to use when unmarshallinguseDefaultObjectMapper
(boolean useDefaultObjectMapper) Whether to lookup and use default Jackson ObjectMapper from the registry.useDefaultObjectMapper
(String useDefaultObjectMapper) Whether to lookup and use default Jackson ObjectMapper from the registry.useList
(boolean useList) To unmarshal to a List of Map or a List of Pojo.To unmarshal to a List of Map or a List of Pojo.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
contentTypeHeader
Whether the data format should set the Content-Type header with the type from the data format. For example application/xml for data formats marshalling to XML, or application/json for data formats marshalling to JSON -
contentTypeHeader
Whether the data format should set the Content-Type header with the type from the data format. For example application/xml for data formats marshalling to XML, or application/json for data formats marshalling to JSON -
dateFormatPattern
To configure the date format while marshall or unmarshall Date fields in JSON using Gson. -
objectMapper
Lookup and use the existing ObjectMapper with the given id when using Jackson. -
useDefaultObjectMapper
Whether to lookup and use default Jackson ObjectMapper from the registry. -
useDefaultObjectMapper
Whether to lookup and use default Jackson ObjectMapper from the registry. -
prettyPrint
To enable pretty printing output nicely formatted. Is by default false. -
prettyPrint
To enable pretty printing output nicely formatted. Is by default false. -
unmarshalTypeName
Class name of the java type to use when unmarshalling -
unmarshalType
Class of the java type to use when unmarshalling -
library
Which json library to use. -
jsonViewTypeName
When marshalling a POJO to JSON you might want to exclude certain fields from the JSON output. With Jackson you can use JSON views to accomplish this. This option is to refer to the class which has @JsonView annotations -
jsonView
When marshalling a POJO to JSON you might want to exclude certain fields from the JSON output. With Jackson you can use JSON views to accomplish this. This option is to refer to the class which has @JsonView annotations -
include
If you want to marshal a pojo to JSON, and the pojo has some fields with null values. And you want to skip these null values, you can set this option to NON_NULL -
allowJmsType
Used for JMS users to allow the JMSType header from the JMS spec to specify a FQN classname to use to unmarshal to. -
allowJmsType
Used for JMS users to allow the JMSType header from the JMS spec to specify a FQN classname to use to unmarshal to. -
collectionTypeName
Refers to a custom collection type to lookup in the registry to use. This option should rarely be used, but allows using different collection types than java.util.Collection based as default. -
collectionType
-
useList
To unmarshal to a List of Map or a List of Pojo. -
useList
To unmarshal to a List of Map or a List of Pojo. -
moduleClassNames
To use custom Jackson modules com.fasterxml.jackson.databind.Module specified as a String with FQN class names. Multiple classes can be separated by comma. -
moduleRefs
To use custom Jackson modules referred from the Camel registry. Multiple modules can be separated by comma. -
enableFeatures
Set of features to enable on the Jackson com.fasterxml.jackson.databind.ObjectMapper. The features should be a name that matches a enum from com.fasterxml.jackson.databind.SerializationFeature, com.fasterxml.jackson.databind.DeserializationFeature, or com.fasterxml.jackson.databind.MapperFeature Multiple features can be separated by comma -
disableFeatures
Set of features to disable on the Jackson com.fasterxml.jackson.databind.ObjectMapper. The features should be a name that matches a enum from com.fasterxml.jackson.databind.SerializationFeature, com.fasterxml.jackson.databind.DeserializationFeature, or com.fasterxml.jackson.databind.MapperFeature Multiple features can be separated by comma -
allowUnmarshallType
If enabled then Jackson is allowed to attempt to use the CamelJacksonUnmarshalType header during the unmarshalling. This should only be enabled when desired to be used. -
allowUnmarshallType
If enabled then Jackson is allowed to attempt to use the CamelJacksonUnmarshalType header during the unmarshalling. This should only be enabled when desired to be used. -
timezone
If set then Jackson will use the Timezone when marshalling/unmarshalling. This option will have no effect on the others Json DataFormat, like gson and fastjson. -
autoDiscoverObjectMapper
If set to true then Jackson will look for an objectMapper to use from the registry -
autoDiscoverObjectMapper
If set to true then Jackson will look for an objectMapper to use from the registry -
schemaResolver
Optional schema resolver used to lookup schemas for the data in transit. -
autoDiscoverSchemaResolver
When not disabled, the SchemaResolver will be looked up into the registry -
autoDiscoverSchemaResolver
When not disabled, the SchemaResolver will be looked up into the registry -
namingStrategy
If set then Jackson will use the the defined Property Naming Strategy. Possible values are: LOWER_CAMEL_CASE, LOWER_DOT_CASE, LOWER_CASE, KEBAB_CASE, SNAKE_CASE and UPPER_CAMEL_CASE -
end
Description copied from interface:DataFormatBuilder
Ends the build of the data format.- Specified by:
end
in interfaceDataFormatBuilder<JsonDataFormat>
- Returns:
- the data format fully built.
-