public class GsonDataFormat
extends org.apache.camel.support.ServiceSupport
implements org.apache.camel.spi.DataFormat, org.apache.camel.spi.DataFormatName
Constructor and Description |
---|
GsonDataFormat() |
GsonDataFormat(Class<?> unmarshalType)
Use the default Gson
Gson and with a custom
unmarshal type |
GsonDataFormat(Class<?> unmarshalType,
com.google.gson.ExclusionStrategy... exclusionStrategies)
Deprecated.
use the setter instead
|
GsonDataFormat(com.google.gson.Gson gson,
Class<?> unmarshalType)
Use a custom Gson mapper and and unmarshal type
|
GsonDataFormat(com.google.gson.Gson gson,
Type unmarshalGenericType)
Use a custom Gson mapper and and unmarshal token type
|
GsonDataFormat(Type unmarshalGenericType)
Use the default Gson
Gson and with a custom
unmarshal generic type |
Modifier and Type | Method and Description |
---|---|
protected void |
doStart() |
protected void |
doStop() |
String |
getDataFormatName() |
String |
getDateFormatPattern() |
List<com.google.gson.ExclusionStrategy> |
getExclusionStrategies() |
com.google.gson.FieldNamingPolicy |
getFieldNamingPolicy() |
com.google.gson.FieldNamingStrategy |
getFieldNamingStrategy() |
com.google.gson.Gson |
getGson() |
com.google.gson.LongSerializationPolicy |
getLongSerializationPolicy() |
Boolean |
getPrettyPrinting()
Deprecated.
use
isPrettyPrint() instead |
Boolean |
getSerializeNulls()
Deprecated.
use
isSerializeNulls() instead |
Type |
getUnmarshalGenericType() |
Class<?> |
getUnmarshalType() |
boolean |
isPrettyPrint() |
boolean |
isSerializeNulls() |
void |
marshal(org.apache.camel.Exchange exchange,
Object graph,
OutputStream stream) |
void |
setDateFormatPattern(String dateFormatPattern) |
void |
setExclusionStrategies(List<com.google.gson.ExclusionStrategy> exclusionStrategies) |
void |
setFieldNamingPolicy(com.google.gson.FieldNamingPolicy fieldNamingPolicy) |
void |
setFieldNamingStrategy(com.google.gson.FieldNamingStrategy fieldNamingStrategy) |
void |
setLongSerializationPolicy(com.google.gson.LongSerializationPolicy longSerializationPolicy) |
void |
setPrettyPrint(boolean prettyPrint) |
void |
setPrettyPrinting(Boolean prettyPrinting)
Deprecated.
use
setPrettyPrint(boolean) instead |
void |
setSerializeNulls(boolean serializeNulls) |
void |
setSerializeNulls(Boolean serializeNulls)
Deprecated.
use
setSerializeNulls(boolean) instead |
void |
setUnmarshalGenericType(Type unmarshalGenericType) |
void |
setUnmarshalType(Class<?> unmarshalType) |
Object |
unmarshal(org.apache.camel.Exchange exchange,
InputStream stream) |
public GsonDataFormat()
public GsonDataFormat(Class<?> unmarshalType)
Gson
and with a custom
unmarshal typeunmarshalType
- the custom unmarshal type@Deprecated public GsonDataFormat(Class<?> unmarshalType, com.google.gson.ExclusionStrategy... exclusionStrategies)
Gson
and with a custom
unmarshal type and ExclusionStrategy
unmarshalType
- the custom unmarshal typeexclusionStrategies
- one or more custom ExclusionStrategy implementationspublic GsonDataFormat(com.google.gson.Gson gson, Class<?> unmarshalType)
gson
- the custom mapperunmarshalType
- the custom unmarshal typepublic GsonDataFormat(Type unmarshalGenericType)
Gson
and with a custom
unmarshal generic typeunmarshalGenericType
- the custom unmarshal generic typepublic GsonDataFormat(com.google.gson.Gson gson, Type unmarshalGenericType)
gson
- the custom mapperunmarshalGenericType
- the custom unmarshal generic typepublic String getDataFormatName()
getDataFormatName
in interface org.apache.camel.spi.DataFormatName
public void marshal(org.apache.camel.Exchange exchange, Object graph, OutputStream stream) throws Exception
marshal
in interface org.apache.camel.spi.DataFormat
Exception
public Object unmarshal(org.apache.camel.Exchange exchange, InputStream stream) throws Exception
unmarshal
in interface org.apache.camel.spi.DataFormat
Exception
protected void doStart() throws Exception
doStart
in class org.apache.camel.support.ServiceSupport
Exception
protected void doStop() throws Exception
doStop
in class org.apache.camel.support.ServiceSupport
Exception
public Class<?> getUnmarshalType()
public void setUnmarshalType(Class<?> unmarshalType)
public Type getUnmarshalGenericType()
public void setUnmarshalGenericType(Type unmarshalGenericType)
public List<com.google.gson.ExclusionStrategy> getExclusionStrategies()
public void setExclusionStrategies(List<com.google.gson.ExclusionStrategy> exclusionStrategies)
public com.google.gson.LongSerializationPolicy getLongSerializationPolicy()
public void setLongSerializationPolicy(com.google.gson.LongSerializationPolicy longSerializationPolicy)
public com.google.gson.FieldNamingPolicy getFieldNamingPolicy()
public void setFieldNamingPolicy(com.google.gson.FieldNamingPolicy fieldNamingPolicy)
public com.google.gson.FieldNamingStrategy getFieldNamingStrategy()
public void setFieldNamingStrategy(com.google.gson.FieldNamingStrategy fieldNamingStrategy)
@Deprecated public Boolean getSerializeNulls()
isSerializeNulls()
insteadpublic boolean isSerializeNulls()
@Deprecated public void setSerializeNulls(Boolean serializeNulls)
setSerializeNulls(boolean)
insteadpublic void setSerializeNulls(boolean serializeNulls)
@Deprecated public Boolean getPrettyPrinting()
isPrettyPrint()
insteadpublic boolean isPrettyPrint()
@Deprecated public void setPrettyPrinting(Boolean prettyPrinting)
setPrettyPrint(boolean)
insteadpublic void setPrettyPrint(boolean prettyPrint)
public String getDateFormatPattern()
public void setDateFormatPattern(String dateFormatPattern)
public com.google.gson.Gson getGson()
Apache Camel