org.apache.camel
Interface TypeConverter

All Known Implementing Classes:
ArrayTypeConverter, AsyncProcessorTypeConverter, DefaultTypeConverter, DozerTypeConverter, EnumTypeConverter, FallbackTypeConverter, FutureTypeConverter, InstanceMethodFallbackTypeConverter, InstanceMethodTypeConverter, OsgiTypeConverter, PropertyEditorTypeConverter, StaticMethodFallbackTypeConverter, StaticMethodTypeConverter, ToStringTypeConverter

public interface TypeConverter

A pluggable strategy to be able to convert objects to different types such as to and from String, InputStream/OutputStream, Reader/Writer, Document, byte[], ByteBuffer etc

Version:
$Revision: 3039 $

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
<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
 

Method Detail

convertTo

<T> T convertTo(Class<T> type,
                Object value)
Converts the value to the specified type

Parameters:
type - the requested type
value - the value to be converted
Returns:
the converted value, or null if not possible to convert

convertTo

<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).

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

<T> T mandatoryConvertTo(Class<T> type,
                         Object value)
                     throws NoTypeConversionAvailableException
Converts the value to the specified type

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

<T> T mandatoryConvertTo(Class<T> type,
                         Exchange exchange,
                         Object value)
                     throws NoTypeConversionAvailableException
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).

Parameters:
type - the requested type
exchange - the current exchange
value - the value to be converted
Returns:
the converted value, is never null
Throws:
NoTypeConversionAvailableException} - if conversion not possible
NoTypeConversionAvailableException


Copyright © 2007-2010 IONA Open Source Community. All Rights Reserved.