biz.xsoftware.mock
Class CalledMethod

java.lang.Object
  extended by biz.xsoftware.mock.CalledMethod
All Implemented Interfaces:
Serializable

public final class CalledMethod
extends Object
implements Serializable

This object contains information about a MockObject method when it is called

Since:
Aug 12, 2004
Author:
Dean Hiller, Brian Freeman
See Also:
Serialized Form

Constructor Summary
CalledMethod(String methodName, Method method, Object[] params, Throwable howItWasCalled)
           
CalledMethod(String methodName, Object[] params, Throwable howItWasCalled)
           
 
Method Summary
 Object[] getAllParams()
          Gets all the parameters that were passed into the method.
 Throwable getHowItWasCalled()
          Returns a stacktrace of how the method was called.
 Method getMethod()
          Gets the method object this CalledMethod object represents
 String getMethodName()
          Gets the method name this CalledMethod object represents
 Object getParameter(int index)
          Gets the parameter at location=index
 int getParameterCount()
          Gets the number of parameters passed into method
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CalledMethod

public CalledMethod(String methodName,
                    Object[] params,
                    Throwable howItWasCalled)

CalledMethod

public CalledMethod(String methodName,
                    Method method,
                    Object[] params,
                    Throwable howItWasCalled)
Method Detail

getMethodName

public String getMethodName()
Gets the method name this CalledMethod object represents

Returns:
The method name

getMethod

public Method getMethod()
Gets the method object this CalledMethod object represents

Returns:
The method object

getParameterCount

public int getParameterCount()
Gets the number of parameters passed into method

Returns:
The number of parameters

getParameter

public Object getParameter(int index)
Gets the parameter at location=index

Parameters:
index - The location of the parameter
Returns:
The parameter that was passed into the method at location=index

getAllParams

public Object[] getAllParams()
Gets all the parameters that were passed into the method. For example, if a method is called ... doSomethingCool("1234", 5, "eeee"), then the following will be returned

new Object[] {"1234", new Integer(5), "eeee")}

Note: The array returned is a clone of the internal array so changes to the returned array will not change the internal array


getHowItWasCalled

public Throwable getHowItWasCalled()
Returns a stacktrace of how the method was called. This is useful for debugging when you didn't expect the method to be called.

Returns:
Throwable of how the method was called.

toString

public String toString()
Overrides:
toString in class Object