org.apache.geronimo.blueprint.container
Class AggregateConverter

java.lang.Object
  extended by org.apache.geronimo.blueprint.container.AggregateConverter
All Implemented Interfaces:
Converter

public class AggregateConverter
extends Object
implements Converter

Implementation of the Converter. This object contains all the registered Converters which can be registered by using registerConverter(Converter) and unregistered using unregisterConverter(Converter). Each BlueprintContainer has its own AggregateConverter used to register converters defined by the related blueprint bundle.

Version:
$Rev: 760378 $, $Date: 2009-03-31 11:31:38 +0200 (Tue, 31 Mar 2009) $
Author:
Apache Geronimo Project

Nested Class Summary
static interface AggregateConverter.Convertible
          Objects implementing this interface will bypass the default conversion rules and be called directly to transform into the expected type.
 
Constructor Summary
AggregateConverter(ExtendedBlueprintContainer blueprintContainer)
           
 
Method Summary
 boolean canConvert(Object fromValue, ReifiedType toType)
          Return if this converter is able to convert the specified object to the specified type.
 Object convert(Object fromValue, ReifiedType type)
          Convert the specified object to an instance of the specified type.
 Object convert(Object source, Type target)
           
 Object convertFromString(String value, Class toType, Object loader)
           
 Object convertToNumber(Number value, Class toType)
           
static boolean isAssignable(Object source, ReifiedType target)
           
 void registerConverter(Converter converter)
           
 void unregisterConverter(Converter converter)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AggregateConverter

public AggregateConverter(ExtendedBlueprintContainer blueprintContainer)
Method Detail

registerConverter

public void registerConverter(Converter converter)

unregisterConverter

public void unregisterConverter(Converter converter)

canConvert

public boolean canConvert(Object fromValue,
                          ReifiedType toType)
Description copied from interface: Converter
Return if this converter is able to convert the specified object to the specified type.

Specified by:
canConvert in interface Converter
Parameters:
fromValue - The source object s to convert.
toType - The target type T.
Returns:
true if the conversion is possible, false otherwise.

convert

public Object convert(Object fromValue,
                      ReifiedType type)
               throws Exception
Description copied from interface: Converter
Convert the specified object to an instance of the specified type.

Specified by:
convert in interface Converter
Parameters:
fromValue - The source object s to convert.
type - The target type T.
Returns:
An instance with a type that is assignable from targetType's raw class
Throws:
Exception - If the conversion cannot succeed. This exception should not be thrown when the canConvert method has returned true.

convertToNumber

public Object convertToNumber(Number value,
                              Class toType)
                       throws Exception
Throws:
Exception

convertFromString

public Object convertFromString(String value,
                                Class toType,
                                Object loader)
                         throws Exception
Throws:
Exception

isAssignable

public static boolean isAssignable(Object source,
                                   ReifiedType target)

convert

public Object convert(Object source,
                      Type target)
               throws Exception
Throws:
Exception


Copyright © 2003-2009 The Apache Software Foundation. All Rights Reserved.