1
2
3
4
5
6
7
8
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 public ObjectToFruitLover()
20 {
21 this.setReturnClass(FruitLover.class);
22 this.registerSourceType(String.class);
23 this.registerSourceType(FruitLover.class);
24 }
25
26 public Object doTransform(Object src, String encoding) throws TransformerException
27 {
28 if (src instanceof FruitLover)
29 {
30 return src;
31 }
32 else
33 {
34 return new FruitLover((String) src);
35 }
36 }
37
38 }