1
2
3
4
5
6
7 package org.mule.module.ibeans.annotations;
8
9 import org.mule.util.StringUtils;
10
11 import org.ibeans.api.InvocationContext;
12 import org.ibeans.api.ParamFactory;
13
14
15
16
17 public class ReversePropertyParamFactory implements ParamFactory
18 {
19 private String propertyName;
20
21 public ReversePropertyParamFactory(String propertyName)
22 {
23 this.propertyName = propertyName;
24 }
25
26 public String create(String paramName, boolean optional, InvocationContext invocationContext)
27 {
28 String prop = (String) invocationContext.getIBeanConfig().getPropertyParams().get(propertyName);
29 if (prop == null && !optional)
30 {
31 throw new IllegalArgumentException("PropertyParam value was null for: " + propertyName);
32 }
33 return StringUtils.reverse(prop);
34 }
35 }