org.apache.aries.blueprint.container
Class AggregateConverter

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

public class AggregateConverter
extends java.lang.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: 990789 $, $Date: 2010-08-30 13:42:03 +0100 (Mon, 30 Aug 2010) $

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(java.lang.Object fromValue, ReifiedType toType)
          Return if this converter is able to convert the specified object to the specified type.
 java.lang.Object convert(java.lang.Object fromValue, ReifiedType type)
          Convert the specified object to an instance of the specified type.
 java.lang.Object convert(java.lang.Object source, java.lang.reflect.Type target)
           
 java.lang.Object convertFromString(java.lang.String value, java.lang.Class toType, java.lang.Object loader)
           
 java.lang.Object convertToNumber(java.lang.Number value, java.lang.Class toType)
           
static boolean isAssignable(java.lang.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(java.lang.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 java.lang.Object convert(java.lang.Object fromValue,
                                ReifiedType type)
                         throws java.lang.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:
java.lang.Exception - If the conversion cannot succeed. This exception should not be thrown when the canConvert method has returned true.

convertToNumber

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

convertFromString

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

isAssignable

public static boolean isAssignable(java.lang.Object source,
                                   ReifiedType target)

convert

public java.lang.Object convert(java.lang.Object source,
                                java.lang.reflect.Type target)
                         throws java.lang.Exception
Throws:
java.lang.Exception


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