Class ProtobufDataFormat
- java.lang.Object
-
- org.apache.camel.model.IdentifiedType
-
- org.apache.camel.model.DataFormatDefinition
-
- org.apache.camel.model.dataformat.ProtobufDataFormat
-
- All Implemented Interfaces:
ContentTypeHeaderAware
@Metadata(firstVersion="2.2.0", label="dataformat,transformation", title="Protobuf") public class ProtobufDataFormat extends DataFormatDefinition implements ContentTypeHeaderAware
Serialize and deserialize Java objects using Google's Protocol buffers.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ProtobufDataFormat.Builder
Builder
is a specific builder forProtobufDataFormat
.
-
Constructor Summary
Constructors Constructor Description ProtobufDataFormat()
ProtobufDataFormat(String instanceClass)
ProtobufDataFormat(String instanceClass, String contentTypeFormat)
ProtobufDataFormat(ProtobufLibrary library)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ProtobufDataFormat
allowUnmarshallType(boolean allowUnmarshallType)
ProtobufDataFormat
allowUnmarshallType(String allowUnmarshallType)
ProtobufDataFormat
autoDiscoverObjectMapper(boolean autoDiscoverObjectMapper)
ProtobufDataFormat
autoDiscoverObjectMapper(String autoDiscoverObjectMapper)
ProtobufDataFormat
collectionType(Class<?> collectionType)
ProtobufDataFormat
collectionType(String collectionType)
ProtobufDataFormat
disableFeatures(String disableFeatures)
ProtobufDataFormat
enableFeatures(String enableFeatures)
String
getAllowJmsType()
String
getAllowUnmarshallType()
String
getAutoDiscoverObjectMapper()
String
getAutoDiscoverSchemaResolver()
Class<?>
getCollectionType()
String
getCollectionTypeName()
String
getContentTypeFormat()
String
getContentTypeHeader()
Whether the data format should set the Content-Type header with the type from the data format.String
getDataFormatName()
Object
getDefaultInstance()
String
getDisableFeatures()
String
getEnableFeatures()
String
getInclude()
String
getInstanceClass()
Class<?>
getJsonView()
String
getJsonViewTypeName()
ProtobufLibrary
getLibrary()
String
getModuleClassNames()
String
getModuleRefs()
String
getObjectMapper()
String
getSchemaResolver()
String
getTimezone()
Class<?>
getUnmarshalType()
String
getUnmarshalTypeName()
String
getUseDefaultObjectMapper()
String
getUseList()
ProtobufDataFormat
include(String include)
ProtobufDataFormat
jsonView(Class<?> jsonView)
ProtobufDataFormat
moduleClassNames(String moduleClassNames)
ProtobufDataFormat
moduleRefs(String moduleRefs)
ProtobufDataFormat
objectMapper(String objectMapper)
void
setAllowJmsType(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.void
setAllowUnmarshallType(String allowUnmarshallType)
If enabled then Jackson is allowed to attempt to use the CamelJacksonUnmarshalType header during the unmarshalling.void
setAutoDiscoverObjectMapper(String autoDiscoverObjectMapper)
If set to true then Jackson will lookup for an objectMapper into the registryvoid
setAutoDiscoverSchemaResolver(String autoDiscoverSchemaResolver)
When not disabled, the SchemaResolver will be looked up into the registryvoid
setCollectionType(Class<?> collectionType)
void
setCollectionTypeName(String collectionTypeName)
Refers to a custom collection type to lookup in the registry to use.void
setContentTypeFormat(String contentTypeFormat)
Defines a content type format in which protobuf message will be serialized/deserialized from(to) the Java been.void
setContentTypeHeader(String contentTypeHeader)
Whether the data format should set the Content-Type header with the type from the data format.void
setDefaultInstance(Object defaultInstance)
void
setDisableFeatures(String disableFeatures)
Set of features to disable on the Jackson com.fasterxml.jackson.databind.ObjectMapper.void
setEnableFeatures(String enableFeatures)
Set of features to enable on the Jackson com.fasterxml.jackson.databind.ObjectMapper.void
setInclude(String include)
If you want to marshal a pojo to JSON, and the pojo has some fields with null values.void
setInstanceClass(String instanceClass)
Name of class to use when unmarshallingvoid
setJsonView(Class<?> jsonView)
When marshalling a POJO to JSON you might want to exclude certain fields from the JSON output.void
setJsonViewTypeName(String jsonViewTypeName)
When marshalling a POJO to JSON you might want to exclude certain fields from the JSON output.void
setLibrary(ProtobufLibrary library)
Which Protobuf library to use.void
setModuleClassNames(String moduleClassNames)
To use custom Jackson modules com.fasterxml.jackson.databind.Module specified as a String with FQN class names.void
setModuleRefs(String moduleRefs)
To use custom Jackson modules referred from the Camel registry.void
setObjectMapper(String objectMapper)
Lookup and use the existing ObjectMapper with the given id when using Jackson.void
setSchemaResolver(String schemaResolver)
Optional schema resolver used to lookup schemas for the data in transit.void
setTimezone(String timezone)
If set then Jackson will use the Timezone when marshalling/unmarshalling.void
setUnmarshalType(Class<?> unmarshalType)
Class of the java type to use when unmarshallingvoid
setUnmarshalTypeName(String unmarshalTypeName)
Class name of the java type to use when unmarshallingvoid
setUseDefaultObjectMapper(String useDefaultObjectMapper)
Whether to lookup and use default Jackson ObjectMapper from the registry.void
setUseList(String useList)
To unmarshal to a List of Map or a List of Pojo.ProtobufDataFormat
unmarshalType(Class<?> unmarshalType)
ProtobufDataFormat
unmarshalType(String unmarshalType)
ProtobufDataFormat
useDefaultObjectMapper(boolean useDefaultObjectMapper)
ProtobufDataFormat
useDefaultObjectMapper(String useDefaultObjectMapper)
ProtobufDataFormat
useList(boolean useList)
ProtobufDataFormat
useList(String useList)
-
Methods inherited from class org.apache.camel.model.DataFormatDefinition
getDataFormat, getShortName, setDataFormat, setDataFormatName
-
Methods inherited from class org.apache.camel.model.IdentifiedType
getId, setId
-
-
-
-
Constructor Detail
-
ProtobufDataFormat
public ProtobufDataFormat()
-
ProtobufDataFormat
public ProtobufDataFormat(ProtobufLibrary library)
-
ProtobufDataFormat
public ProtobufDataFormat(String instanceClass)
-
-
Method Detail
-
getDataFormatName
public String getDataFormatName()
- Overrides:
getDataFormatName
in classDataFormatDefinition
-
getInstanceClass
public String getInstanceClass()
-
setInstanceClass
public void setInstanceClass(String instanceClass)
Name of class to use when unmarshalling
-
setContentTypeFormat
public void setContentTypeFormat(String contentTypeFormat)
Defines a content type format in which protobuf message will be serialized/deserialized from(to) the Java been. The format can either be native or json for either native protobuf or json fields representation. The default value is native.
-
getContentTypeFormat
public String getContentTypeFormat()
-
getContentTypeHeader
public String getContentTypeHeader()
Description copied from interface:ContentTypeHeaderAware
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 etc.- Specified by:
getContentTypeHeader
in interfaceContentTypeHeaderAware
-
setContentTypeHeader
public void setContentTypeHeader(String contentTypeHeader)
Description copied from interface:ContentTypeHeaderAware
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 etc.- Specified by:
setContentTypeHeader
in interfaceContentTypeHeaderAware
-
getDefaultInstance
public Object getDefaultInstance()
-
setDefaultInstance
public void setDefaultInstance(Object defaultInstance)
-
getLibrary
public ProtobufLibrary getLibrary()
-
setLibrary
public void setLibrary(ProtobufLibrary library)
Which Protobuf library to use.
-
getObjectMapper
public String getObjectMapper()
-
setObjectMapper
public void setObjectMapper(String objectMapper)
Lookup and use the existing ObjectMapper with the given id when using Jackson.
-
getUseDefaultObjectMapper
public String getUseDefaultObjectMapper()
-
setUseDefaultObjectMapper
public void setUseDefaultObjectMapper(String useDefaultObjectMapper)
Whether to lookup and use default Jackson ObjectMapper from the registry.
-
getUnmarshalTypeName
public String getUnmarshalTypeName()
-
setUnmarshalTypeName
public void setUnmarshalTypeName(String unmarshalTypeName)
Class name of the java type to use when unmarshalling
-
getUnmarshalType
public Class<?> getUnmarshalType()
-
setUnmarshalType
public void setUnmarshalType(Class<?> unmarshalType)
Class of the java type to use when unmarshalling
-
getJsonViewTypeName
public String getJsonViewTypeName()
-
setJsonViewTypeName
public void setJsonViewTypeName(String 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
-
getJsonView
public Class<?> getJsonView()
-
setJsonView
public void setJsonView(Class<?> 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
-
getInclude
public String getInclude()
-
setInclude
public void setInclude(String 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
-
getAllowJmsType
public String getAllowJmsType()
-
setAllowJmsType
public void setAllowJmsType(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.
-
getCollectionTypeName
public String getCollectionTypeName()
-
setCollectionTypeName
public void setCollectionTypeName(String collectionTypeName)
Refers to a custom collection type to lookup in the registry to use. This option should rarely be used, but allows to use different collection types than java.util.Collection based as default.
-
getCollectionType
public Class<?> getCollectionType()
-
setCollectionType
public void setCollectionType(Class<?> collectionType)
-
getUseList
public String getUseList()
-
setUseList
public void setUseList(String useList)
To unmarshal to a List of Map or a List of Pojo.
-
getModuleClassNames
public String getModuleClassNames()
-
setModuleClassNames
public void setModuleClassNames(String 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.
-
getModuleRefs
public String getModuleRefs()
-
setModuleRefs
public void setModuleRefs(String moduleRefs)
To use custom Jackson modules referred from the Camel registry. Multiple modules can be separated by comma.
-
getEnableFeatures
public String getEnableFeatures()
-
setEnableFeatures
public void setEnableFeatures(String 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
-
getDisableFeatures
public String getDisableFeatures()
-
setDisableFeatures
public void setDisableFeatures(String 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
-
getAllowUnmarshallType
public String getAllowUnmarshallType()
-
setAllowUnmarshallType
public void setAllowUnmarshallType(String 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.
-
getTimezone
public String getTimezone()
-
setTimezone
public void setTimezone(String timezone)
If set then Jackson will use the Timezone when marshalling/unmarshalling.
-
getAutoDiscoverObjectMapper
public String getAutoDiscoverObjectMapper()
-
setAutoDiscoverObjectMapper
public void setAutoDiscoverObjectMapper(String autoDiscoverObjectMapper)
If set to true then Jackson will lookup for an objectMapper into the registry
-
setSchemaResolver
public void setSchemaResolver(String schemaResolver)
Optional schema resolver used to lookup schemas for the data in transit.
-
getSchemaResolver
public String getSchemaResolver()
-
getAutoDiscoverSchemaResolver
public String getAutoDiscoverSchemaResolver()
-
setAutoDiscoverSchemaResolver
public void setAutoDiscoverSchemaResolver(String autoDiscoverSchemaResolver)
When not disabled, the SchemaResolver will be looked up into the registry
-
objectMapper
public ProtobufDataFormat objectMapper(String objectMapper)
-
useDefaultObjectMapper
public ProtobufDataFormat useDefaultObjectMapper(boolean useDefaultObjectMapper)
-
useDefaultObjectMapper
public ProtobufDataFormat useDefaultObjectMapper(String useDefaultObjectMapper)
-
unmarshalType
public ProtobufDataFormat unmarshalType(String unmarshalType)
-
unmarshalType
public ProtobufDataFormat unmarshalType(Class<?> unmarshalType)
-
jsonView
public ProtobufDataFormat jsonView(Class<?> jsonView)
-
include
public ProtobufDataFormat include(String include)
-
collectionType
public ProtobufDataFormat collectionType(String collectionType)
-
collectionType
public ProtobufDataFormat collectionType(Class<?> collectionType)
-
useList
public ProtobufDataFormat useList(boolean useList)
-
useList
public ProtobufDataFormat useList(String useList)
-
moduleClassNames
public ProtobufDataFormat moduleClassNames(String moduleClassNames)
-
moduleRefs
public ProtobufDataFormat moduleRefs(String moduleRefs)
-
enableFeatures
public ProtobufDataFormat enableFeatures(String enableFeatures)
-
disableFeatures
public ProtobufDataFormat disableFeatures(String disableFeatures)
-
allowUnmarshallType
public ProtobufDataFormat allowUnmarshallType(boolean allowUnmarshallType)
-
allowUnmarshallType
public ProtobufDataFormat allowUnmarshallType(String allowUnmarshallType)
-
autoDiscoverObjectMapper
public ProtobufDataFormat autoDiscoverObjectMapper(boolean autoDiscoverObjectMapper)
-
autoDiscoverObjectMapper
public ProtobufDataFormat autoDiscoverObjectMapper(String autoDiscoverObjectMapper)
-
-