org.granite.messaging.amf.io.convert
Class Converter

java.lang.Object
  extended by org.granite.messaging.amf.io.convert.Converter
Direct Known Subclasses:
Array2Array, Array2Collection, Boolean2Boolean, Character2Character, Collection2Array, Collection2Collection, Compatibility, Date2Date, GAEKeyConverter, Map2Map, Number2BigDecimal, Number2BigInteger, Number2Byte, Number2Double, Number2Float, Number2Integer, Number2Long, Number2Short, String2Char, String2CharArray, String2Document, String2Locale, String2URI

public abstract class Converter
extends Object

Author:
Franck WOLFF

Field Summary
protected  Converters converters
           
 
Constructor Summary
Converter(Converters converters)
          Build a new Converter instance.
 
Method Summary
 boolean canConvert(Object value, Type targetType)
          Tells if the supplied object may be converted to the supplied target type by this converter.
 Object convert(Object value, Type targetType)
          Converts the supplied object to the supplied target type.
protected abstract  boolean internalCanConvert(Object value, Type targetType)
           
protected abstract  Object internalConvert(Object value, Type targetType)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

converters

protected final Converters converters
Constructor Detail

Converter

public Converter(Converters converters)
Build a new Converter instance.

Parameters:
converters - a Converters instance (must be not null).
Throws:
NullPointerException - (if converters is null).
Method Detail

canConvert

public final boolean canConvert(Object value,
                                Type targetType)
Tells if the supplied object may be converted to the supplied target type by this converter.

Parameters:
value - the object to be converted.
targetType - the target type.
Returns:
true if this converter can convert o to the target type, false otherwise.

internalCanConvert

protected abstract boolean internalCanConvert(Object value,
                                              Type targetType)

convert

public final Object convert(Object value,
                            Type targetType)
Converts the supplied object to the supplied target type.

Parameters:
value - the object to be converted.
targetType - the target type.
Returns:
the converted object.

internalConvert

protected abstract Object internalConvert(Object value,
                                          Type targetType)