org.apache.camel.impl.converter
Class StaticMethodTypeConverter

java.lang.Object
  extended by org.apache.camel.support.TypeConverterSupport
      extended by org.apache.camel.impl.converter.StaticMethodTypeConverter
All Implemented Interfaces:
TypeConverter

public class StaticMethodTypeConverter
extends TypeConverterSupport

A TypeConverter implementation which invokes a static method to convert from a type to another type

Version:

Constructor Summary
StaticMethodTypeConverter(Method method)
          Deprecated. 
StaticMethodTypeConverter(Method method, boolean allowNull)
           
 
Method Summary
 boolean allowNull()
          Whether the type converter allows returning null as a valid response.
<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).

 String toString()
           
 
Methods inherited from class org.apache.camel.support.TypeConverterSupport
convertTo, mandatoryConvertTo, mandatoryConvertTo, tryConvertTo, tryConvertTo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StaticMethodTypeConverter

@Deprecated
public StaticMethodTypeConverter(Method method)
Deprecated. 


StaticMethodTypeConverter

public StaticMethodTypeConverter(Method method,
                                 boolean allowNull)
Method Detail

toString

public String toString()
Overrides:
toString in class Object

allowNull

public boolean allowNull()
Description copied from interface: TypeConverter
Whether the type converter allows returning null as a valid response.

By default null is not a valid response, returning false from this method.

Specified by:
allowNull in interface TypeConverter
Overrides:
allowNull in class TypeConverterSupport

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

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


Apache Camel