View Javadoc

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   * Put Class-Name and Method-name in a Map:
11   * <code>
12   * Map map = new HashMap(1);
13   * map.put(className, methodName);
14   * </code>
15   * @author Linke
16   *
17   */
18  public class ClassMethodMapInvocationStrategy implements InvocationStrategy {
19  
20  	public Object convert(Map pvPropertyMap) {
21  		String lvClass = (String) pvPropertyMap.get(InvocationStrategy.CLASS_NAME);
22  		String lvMethod = (String) pvPropertyMap.get(InvocationStrategy.METHOD_NAME);
23  		if ((lvClass == null) || (lvMethod == null)) {
24  			throw new InvocationException("Error in the InvocationStrategy " +this.getClass().getName() + ". "
25  					+ "The class: " + lvClass + " and the method: " + lvMethod + " must be unequal null!");
26  		}
27  		Map lvMap = new HashMap(1);
28  		lvMap.put(lvClass, lvMethod);
29  		return lvMap;
30  	}
31  
32  }