View Javadoc

1   package net.sf.crispy.strategy;
2   
3   import java.util.Map;
4   
5   import net.sf.crispy.InvocationStrategy;
6   
7   /**
8    * Example:
9    * <br>
10   * namespace (class): <i>test.crispy.example.service.Calculator</i> or const: <i>my_namespace</i> 
11   * <br>
12   * invocation string = method name: <i>add</i>
13   * <br>
14   * <b>convert result:</b> <i>test.crispy.example.service.Calculator.add</i> or <b>convert result:</b> <i>my_namespace.add</i>
15   * 
16   * @author Linke
17   *
18   */
19  public class NameSpacePlusMethodInvocationStrategy implements InvocationStrategy {
20  
21  	public Object convert(Map pvPropertyMap) {
22  		String lvNameSpace = (String) pvPropertyMap.get(InvocationStrategy.CLASS_NAME);
23  		String lvConstNameSpace = (String) pvPropertyMap.get(InvocationStrategy.CONST_NAMESPACE);
24  		if (lvConstNameSpace != null) { lvNameSpace = lvConstNameSpace; }
25  		
26  		String lvInvocationString = (String) pvPropertyMap.get(InvocationStrategy.METHOD_NAME);
27  		return lvNameSpace + '.' +  lvInvocationString;
28  	}
29  
30  }