KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mule > config > converters > TransformerConverter


1 /*
2  * $Id: TransformerConverter.java 3831 2006-11-07 22:29:59Z aperepel $
3  * --------------------------------------------------------------------------------------
4  * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com
5  *
6  * The software in this package is published under the terms of the MuleSource MPL
7  * license, a copy of which has been included with this distribution in the
8  * LICENSE.txt file.
9  */

10
11 package org.mule.config.converters;
12
13 import org.apache.commons.beanutils.ConversionException;
14 import org.apache.commons.beanutils.Converter;
15 import org.mule.umo.transformer.UMOTransformer;
16
17 /**
18  * <code>TransformerConverter</code> will obtain a transformer name and convert it
19  * to a transformer instance by looking up the transformer from the
20  * <code>MuleManager</code>.
21  */

22 public class TransformerConverter implements Converter
23 {
24     /**
25      * Convert the specified input object into an output object of the specified
26      * type.
27      *
28      * @param type Data type to which this value should be converted
29      * @param value The input value to be converted
30      * @throws ConversionException if conversion cannot be performed successfully
31      */

32     public Object JavaDoc convert(Class JavaDoc type, Object JavaDoc value)
33     {
34         if (value == null)
35         {
36             throw new ConversionException("No value specified");
37         }
38         if (value instanceof UMOTransformer)
39         {
40             return value;
41         }
42         return null;
43     }
44 }
45
Popular Tags