org.codehaus.spice.converter
Class AbstractMasterConverter

java.lang.Object
  |
  +--org.codehaus.spice.converter.AbstractMasterConverter
All Implemented Interfaces:
Converter
Direct Known Subclasses:
DefaultMasterConverter, SimpleMasterConverter

public abstract class AbstractMasterConverter
extends Object
implements Converter

This is a Converter implementation that is capable of converting between many different source and destination types, by delegating delegates to other converters that do the actual work.

To use this class you must subclass it, and register some converters using the (@link #registerConverter} method.

Version:
$Revision: 1.1 $ $Date: 2003/12/02 08:37:56 $
Author:
Peter Donald

Constructor Summary
AbstractMasterConverter()
           
 
Method Summary
 Object convert(Class destination, Object original, Object context)
          Convert object to destination type.
protected  void registerConverter(ConverterFactory factory, String source, String destination)
          Register a converter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractMasterConverter

public AbstractMasterConverter()
Method Detail

convert

public Object convert(Class destination,
                      Object original,
                      Object context)
               throws ConverterException
Convert object to destination type.

Specified by:
convert in interface Converter
Parameters:
destination - the destination type
original - the original object
context - the context in which to convert
Returns:
the converted object
Throws:
ConverterException - if an error occurs

registerConverter

protected void registerConverter(ConverterFactory factory,
                                 String source,
                                 String destination)
Register a converter

Parameters:
factory - the factory to use to create converter instances.
source - the source classname
destination - the destination classname


Copyright © 2000-2003 Codehaus. All Rights Reserved.