| 1 | /* |
| 2 | * Created on Aug 12, 2004 |
| 3 | * |
| 4 | * TODO To change the template for this generated file go to |
| 5 | * Window - Preferences - Java - Code Style - Code Templates |
| 6 | */ |
| 7 | package biz.xsoftware.mock.client; |
| 8 | |
| 9 | import java.util.Arrays; |
| 10 | import java.util.List; |
| 11 | |
| 12 | /** |
| 13 | * @author Dean Hiller |
| 14 | * |
| 15 | * TODO To change the template for this generated type comment go to |
| 16 | * Window - Preferences - Java - Code Style - Code Templates |
| 17 | */ |
| 18 | public class JsCalledMethod { |
| 19 | |
| 20 | private String method; |
| 21 | private Object[] params; |
| 22 | private Throwable howItWasCalled; |
| 23 | |
| 24 | public JsCalledMethod(String method, Object[] params, Throwable howItWasCalled) { |
| 25 | this.method = method; |
| 26 | if(params == null) |
| 27 | this.params = new Object[0]; |
| 28 | else |
| 29 | this.params = params; |
| 30 | this.howItWasCalled = howItWasCalled; |
| 31 | } |
| 32 | |
| 33 | public String getMethodName() { |
| 34 | return method; |
| 35 | } |
| 36 | |
| 37 | public int getParameterCount() { |
| 38 | return params.length; |
| 39 | } |
| 40 | |
| 41 | public Object getParameter(int index) { |
| 42 | return params[index]; |
| 43 | } |
| 44 | /** |
| 45 | * |
| 46 | */ |
| 47 | public Object[] getAllParams() { |
| 48 | return params; |
| 49 | } |
| 50 | |
| 51 | public Throwable getHowItWasCalled() { |
| 52 | return howItWasCalled; |
| 53 | } |
| 54 | |
| 55 | public String toString() { |
| 56 | List paramList = null; |
| 57 | if(params != null) |
| 58 | paramList = Arrays.asList(params); |
| 59 | |
| 60 | return "[method="+method+" params="+paramList+"]"; |
| 61 | } |
| 62 | } |