1
2
3
4
5
6
7
8
9
10
11 package org.mule.transformers.simple;
12
13 import org.mule.transformers.AbstractTransformer;
14 import org.mule.umo.transformer.TransformerException;
15
16 import org.apache.commons.beanutils.PropertyUtils;
17
18
19
20
21
22
23
24
25
26
27
28 public class GetBeanProperty extends AbstractTransformer
29 {
30 private String propertyName;
31
32 public GetBeanProperty()
33 {
34 super();
35 registerSourceType(Object.class);
36 setReturnClass(Object.class);
37 }
38
39 public Object doTransform(Object src, String encoding) throws TransformerException
40 {
41 try
42 {
43 return PropertyUtils.getProperty(src, this.propertyName);
44 }
45 catch (Exception e)
46 {
47 throw new TransformerException(this, e);
48 }
49 }
50
51 public String getPropertyName()
52 {
53 return propertyName;
54 }
55
56 public void setPropertyName(String propertyName)
57 {
58 this.propertyName = propertyName;
59 }
60
61 }