org.apache.camel.converter.jaxb
Class FallbackTypeConverter

java.lang.Object
  extended by org.apache.camel.converter.jaxb.FallbackTypeConverter
All Implemented Interfaces:
TypeConverterAware, TypeConverter

public class FallbackTypeConverter
extends Object
implements TypeConverter, TypeConverterAware

Version:

Constructor Summary
FallbackTypeConverter()
           
 
Method Summary
<T> T
convertTo(Class<T> type, Exchange exchange, Object value)
          Converts the value to the specified type in the context of an exchange

Used when conversion requires extra information from the current exchange (such as encoding).

<T> T
convertTo(Class<T> type, Object value)
          Converts the value to the specified type
protected
<T> JAXBContext
createContext(Class<T> type)
           
protected
<T> boolean
isJaxbType(Class<T> type)
           
 boolean isPrettyPrint()
           
<T> T
mandatoryConvertTo(Class<T> type, Exchange exchange, Object value)
          Converts the value to the specified type in the context of an exchange

Used when conversion requires extra information from the current exchange (such as encoding).

<T> T
mandatoryConvertTo(Class<T> type, Object value)
          Converts the value to the specified type
protected
<T> T
marshall(Class<T> type, Exchange exchange, Object value)
           
protected  boolean needFiltering(Exchange exchange)
           
 void setPrettyPrint(boolean prettyPrint)
           
 void setTypeConverter(TypeConverter parentTypeConverter)
          Injects the root type converter.
protected  Object unmarshal(Unmarshaller unmarshaller, Exchange exchange, Object value)
           
protected
<T> T
unmarshall(Class<T> type, Exchange exchange, Object value)
          Lets try parse via JAXB
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FallbackTypeConverter

public FallbackTypeConverter()
Method Detail

isPrettyPrint

public boolean isPrettyPrint()

setPrettyPrint

public void setPrettyPrint(boolean prettyPrint)

setTypeConverter

public void setTypeConverter(TypeConverter parentTypeConverter)
Description copied from interface: TypeConverterAware
Injects the root type converter.

Specified by:
setTypeConverter in interface TypeConverterAware
Parameters:
parentTypeConverter - the root type converter

convertTo

public <T> T convertTo(Class<T> type,
                       Object value)
Description copied from interface: TypeConverter
Converts the value to the specified type

Specified by:
convertTo in interface TypeConverter
Parameters:
type - the requested type
value - the value to be converted
Returns:
the converted value, or null if not possible to convert

convertTo

public <T> T convertTo(Class<T> type,
                       Exchange exchange,
                       Object value)
Description copied from interface: TypeConverter
Converts the value to the specified type in the context of an exchange

Used when conversion requires extra information from the current exchange (such as encoding).

Specified by:
convertTo in interface TypeConverter
Parameters:
type - the requested type
exchange - the current exchange
value - the value to be converted
Returns:
the converted value, or null if not possible to convert

mandatoryConvertTo

public <T> T mandatoryConvertTo(Class<T> type,
                                Object value)
                     throws NoTypeConversionAvailableException
Description copied from interface: TypeConverter
Converts the value to the specified type

Specified by:
mandatoryConvertTo in interface TypeConverter
Parameters:
type - the requested type
value - the value to be converted
Returns:
the converted value, is never null
Throws:
NoTypeConversionAvailableException - if conversion not possible

mandatoryConvertTo

public <T> T mandatoryConvertTo(Class<T> type,
                                Exchange exchange,
                                Object value)
                     throws NoTypeConversionAvailableException
Description copied from interface: TypeConverter
Converts the value to the specified type in the context of an exchange

Used when conversion requires extra information from the current exchange (such as encoding).

Specified by:
mandatoryConvertTo in interface TypeConverter
Parameters:
type - the requested type
exchange - the current exchange
value - the value to be converted
Returns:
the converted value, is never null
Throws:
NoTypeConversionAvailableException

isJaxbType

protected <T> boolean isJaxbType(Class<T> type)

unmarshall

protected <T> T unmarshall(Class<T> type,
                           Exchange exchange,
                           Object value)
                throws Exception
Lets try parse via JAXB

Throws:
Exception

marshall

protected <T> T marshall(Class<T> type,
                         Exchange exchange,
                         Object value)
              throws JAXBException,
                     XMLStreamException,
                     FactoryConfigurationError
Throws:
JAXBException
XMLStreamException
FactoryConfigurationError

unmarshal

protected Object unmarshal(Unmarshaller unmarshaller,
                           Exchange exchange,
                           Object value)
                    throws JAXBException,
                           UnsupportedEncodingException
Throws:
JAXBException
UnsupportedEncodingException

needFiltering

protected boolean needFiltering(Exchange exchange)

createContext

protected <T> JAXBContext createContext(Class<T> type)
                             throws JAXBException
Throws:
JAXBException


Apache CAMEL