public class GsonDataFormat
extends org.apache.camel.support.ServiceSupport
implements org.apache.camel.spi.DataFormat
| 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
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
doStart() |
protected void |
doStop() |
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() |
Boolean |
getSerializeNulls() |
Class<?> |
getUnmarshalType() |
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 |
setPrettyPrinting(Boolean prettyPrinting) |
void |
setSerializeNulls(Boolean serializeNulls) |
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 ExclusionStrategyunmarshalType - 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 void marshal(org.apache.camel.Exchange exchange,
Object graph,
OutputStream stream)
throws Exception
marshal in interface org.apache.camel.spi.DataFormatExceptionpublic Object unmarshal(org.apache.camel.Exchange exchange, InputStream stream) throws Exception
unmarshal in interface org.apache.camel.spi.DataFormatExceptionprotected void doStart()
throws Exception
doStart in class org.apache.camel.support.ServiceSupportExceptionprotected void doStop()
throws Exception
doStop in class org.apache.camel.support.ServiceSupportExceptionpublic Class<?> getUnmarshalType()
public void setUnmarshalType(Class<?> unmarshalType)
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)
public Boolean getSerializeNulls()
public void setSerializeNulls(Boolean serializeNulls)
public Boolean getPrettyPrinting()
public void setPrettyPrinting(Boolean prettyPrinting)
public String getDateFormatPattern()
public void setDateFormatPattern(String dateFormatPattern)
public com.google.gson.Gson getGson()
Apache Camel