KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mule > tck > testmodels > fruit > ObjectToFruitLover


1 /*
2  * $Id: ObjectToFruitLover.java 3798 2006-11-04 04:07:14Z 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.tck.testmodels.fruit;
12
13 import org.mule.transformers.AbstractTransformer;
14 import org.mule.umo.transformer.TransformerException;
15
16 public class ObjectToFruitLover extends AbstractTransformer
17 {
18     /**
19      * Serial version
20      */

21     private static final long serialVersionUID = -6760497986912711312L;
22
23     public ObjectToFruitLover()
24     {
25         this.setReturnClass(FruitLover.class);
26         this.registerSourceType(String JavaDoc.class);
27         this.registerSourceType(FruitLover.class);
28     }
29
30     public Object JavaDoc doTransform(Object JavaDoc src, String JavaDoc encoding) throws TransformerException
31     {
32         if (src instanceof FruitLover)
33         {
34             return src;
35         }
36         else
37         {
38             return new FruitLover((String JavaDoc)src);
39         }
40     }
41
42 }
43
Popular Tags