Class JohnzonDataFormat
- java.lang.Object
-
- org.apache.camel.support.service.BaseService
-
- org.apache.camel.support.service.ServiceSupport
-
- org.apache.camel.component.johnzon.JohnzonDataFormat
-
- All Implemented Interfaces:
AutoCloseable,org.apache.camel.CamelContextAware,org.apache.camel.Service,org.apache.camel.ShutdownableService,org.apache.camel.spi.DataFormat,org.apache.camel.spi.DataFormatName,org.apache.camel.StatefulService,org.apache.camel.SuspendableService
@Dataformat("johnzon") @Metadata(includeProperties="unmarshalType,unmarshalTypeName,objectMapper,prettyPrint") public class JohnzonDataFormat extends org.apache.camel.support.service.ServiceSupport implements org.apache.camel.spi.DataFormat, org.apache.camel.spi.DataFormatName, org.apache.camel.CamelContextAwareMarshal POJOs to JSON and back using Johnzon
-
-
Constructor Summary
Constructors Constructor Description JohnzonDataFormat()JohnzonDataFormat(Class<?> unmarshalType)Use the default JohnzonMapperand with a custom unmarshal typeJohnzonDataFormat(org.apache.johnzon.mapper.Mapper mapper, Class<?> unmarshalType)Use a custom Johnzon mapper and unmarshal typeJohnzonDataFormat(org.apache.johnzon.mapper.Mapper mapper, org.apache.johnzon.mapper.reflection.JohnzonParameterizedType parameterizedType)Use a custom Johnzon mapper and unmarshal typeJohnzonDataFormat(org.apache.johnzon.mapper.reflection.JohnzonParameterizedType parameterizedType)Use the default JohnzonMapperand with a custom parameterized type
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddoInit()protected voiddoStart()protected voiddoStop()Comparator<String>getAttributeOrder()org.apache.camel.CamelContextgetCamelContext()StringgetDataFormatName()StringgetEncoding()org.apache.johnzon.mapper.MappergetObjectMapper()org.apache.johnzon.mapper.reflection.JohnzonParameterizedTypegetParameterizedType()Class<?>getUnmarshalType()StringgetUnmarshalTypeName()booleanisPrettyPrint()booleanisSkipEmptyArray()booleanisSkipNull()voidmarshal(org.apache.camel.Exchange exchange, Object graph, OutputStream stream)voidsetAttributeOrder(Comparator<String> attributeOrder)voidsetCamelContext(org.apache.camel.CamelContext camelContext)voidsetEncoding(String encoding)voidsetObjectMapper(org.apache.johnzon.mapper.Mapper objectMapper)voidsetParameterizedType(org.apache.johnzon.mapper.reflection.JohnzonParameterizedType parameterizedType)voidsetPrettyPrint(boolean prettyPrint)voidsetSkipEmptyArray(boolean skipEmptyArray)voidsetSkipNull(boolean skipNull)voidsetUnmarshalType(Class<?> unmarshalType)voidsetUnmarshalTypeName(String unmarshalTypeName)Objectunmarshal(org.apache.camel.Exchange exchange, InputStream stream)-
Methods inherited from class org.apache.camel.support.service.BaseService
build, doBuild, doFail, doLifecycleChange, doResume, doShutdown, doSuspend, fail, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
-
-
Constructor Detail
-
JohnzonDataFormat
public JohnzonDataFormat()
-
JohnzonDataFormat
public JohnzonDataFormat(Class<?> unmarshalType)
Use the default JohnzonMapperand with a custom unmarshal type- Parameters:
unmarshalType- the custom unmarshal type
-
JohnzonDataFormat
public JohnzonDataFormat(org.apache.johnzon.mapper.reflection.JohnzonParameterizedType parameterizedType)
Use the default JohnzonMapperand with a custom parameterized type- Parameters:
parameterizedType- the custom parameterized type
-
JohnzonDataFormat
public JohnzonDataFormat(org.apache.johnzon.mapper.Mapper mapper, Class<?> unmarshalType)Use a custom Johnzon mapper and unmarshal type- Parameters:
mapper- the custom mapperunmarshalType- the custom unmarshal type
-
JohnzonDataFormat
public JohnzonDataFormat(org.apache.johnzon.mapper.Mapper mapper, org.apache.johnzon.mapper.reflection.JohnzonParameterizedType parameterizedType)Use a custom Johnzon mapper and unmarshal type- Parameters:
mapper- the custom mapperparameterizedType- the JohnzonParameterizedType type
-
-
Method Detail
-
setCamelContext
public void setCamelContext(org.apache.camel.CamelContext camelContext)
- Specified by:
setCamelContextin interfaceorg.apache.camel.CamelContextAware
-
getCamelContext
public org.apache.camel.CamelContext getCamelContext()
- Specified by:
getCamelContextin interfaceorg.apache.camel.CamelContextAware
-
getDataFormatName
public String getDataFormatName()
- Specified by:
getDataFormatNamein interfaceorg.apache.camel.spi.DataFormatName
-
getObjectMapper
public org.apache.johnzon.mapper.Mapper getObjectMapper()
-
setObjectMapper
public void setObjectMapper(org.apache.johnzon.mapper.Mapper objectMapper)
-
getUnmarshalType
public Class<?> getUnmarshalType()
-
setUnmarshalType
public void setUnmarshalType(Class<?> unmarshalType)
-
getUnmarshalTypeName
public String getUnmarshalTypeName()
-
setUnmarshalTypeName
public void setUnmarshalTypeName(String unmarshalTypeName)
-
getParameterizedType
public org.apache.johnzon.mapper.reflection.JohnzonParameterizedType getParameterizedType()
-
setParameterizedType
public void setParameterizedType(org.apache.johnzon.mapper.reflection.JohnzonParameterizedType parameterizedType)
-
isPrettyPrint
public boolean isPrettyPrint()
-
setPrettyPrint
public void setPrettyPrint(boolean prettyPrint)
-
getEncoding
public String getEncoding()
-
setEncoding
public void setEncoding(String encoding)
-
isSkipEmptyArray
public boolean isSkipEmptyArray()
-
setSkipEmptyArray
public void setSkipEmptyArray(boolean skipEmptyArray)
-
isSkipNull
public boolean isSkipNull()
-
setSkipNull
public void setSkipNull(boolean skipNull)
-
getAttributeOrder
public Comparator<String> getAttributeOrder()
-
setAttributeOrder
public void setAttributeOrder(Comparator<String> attributeOrder)
-
marshal
public void marshal(org.apache.camel.Exchange exchange, Object graph, OutputStream stream) throws Exception- Specified by:
marshalin interfaceorg.apache.camel.spi.DataFormat- Throws:
Exception
-
unmarshal
public Object unmarshal(org.apache.camel.Exchange exchange, InputStream stream) throws Exception
- Specified by:
unmarshalin interfaceorg.apache.camel.spi.DataFormat- Throws:
Exception
-
doInit
protected void doInit() throws Exception- Overrides:
doInitin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
doStart
protected void doStart() throws Exception- Overrides:
doStartin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
-