|
1 |
| package net.sf.crispy.strategy; |
|
2 |
| |
|
3 |
| import java.util.HashMap; |
|
4 |
| import java.util.Map; |
|
5 |
| |
|
6 |
| import net.sf.crispy.InvocationException; |
|
7 |
| import net.sf.crispy.InvocationStrategy; |
|
8 |
| |
|
9 |
| |
|
10 |
| |
|
11 |
| |
|
12 |
| |
|
13 |
| |
|
14 |
| |
|
15 |
| |
|
16 |
| |
|
17 |
| |
|
18 |
| public class ClassMethodMapInvocationStrategy implements InvocationStrategy { |
|
19 |
| |
|
20 |
57
| public Object convert(Map pvPropertyMap) {
|
|
21 |
57
| String lvClass = (String) pvPropertyMap.get(InvocationStrategy.CLASS_NAME);
|
|
22 |
57
| String lvMethod = (String) pvPropertyMap.get(InvocationStrategy.METHOD_NAME);
|
|
23 |
57
| if ((lvClass == null) || (lvMethod == null)) {
|
|
24 |
2
| throw new InvocationException("Error in the InvocationStrategy " +this.getClass().getName() + ". "
|
|
25 |
| + "The class: " + lvClass + " and the method: " + lvMethod + " must be unequal null!"); |
|
26 |
| } |
|
27 |
55
| Map lvMap = new HashMap(1);
|
|
28 |
55
| lvMap.put(lvClass, lvMethod);
|
|
29 |
55
| return lvMap;
|
|
30 |
| } |
|
31 |
| |
|
32 |
| } |