org.virtualmock.aspect
Class AspectUtils

java.lang.Object
  extended byorg.virtualmock.aspect.AspectUtils

public class AspectUtils
extends java.lang.Object

This class consists of utility methods which have been abstracted out of the Advice class. This makes them easier to debug and unit test. It also acts as an encapsulation layer between the advices and the rest of the class. This is the only class which deals with aspect-specific classes, such as JoinPoints.

Version:
$Revision: 1.15 $
Author:
Chad Woolley

Constructor Summary
AspectUtils()
           
 
Method Summary
 java.lang.String[] createArgumentNames(java.lang.Object[] argumentValues)
          Create dummy argument names.
 java.util.Hashtable hashArguments(java.lang.Class[] argumentTypes, java.lang.Object[] argumentValues)
          Transform two arrays of matching argument types and argument values into a hashtable of corresponding key/value pairs, with the argumentType as the key.
 boolean isClassExcluded(java.lang.Class targetClass)
          Returns true if the specified class should be excluded from VirtualMock processing.
 java.lang.Object playbackMockCall(InvokedCall invokedCall, RecordedCall recordedCall)
          Performs the logic of playing back a recorded mock call.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AspectUtils

public AspectUtils()
Method Detail

isClassExcluded

public boolean isClassExcluded(java.lang.Class targetClass)
Returns true if the specified class should be excluded from VirtualMock processing.

Parameters:
targetClass - the class which will be checked to see if it should be excluded
Returns:
true if the specified class should be excluded

createArgumentNames

public java.lang.String[] createArgumentNames(java.lang.Object[] argumentValues)
Create dummy argument names.

Parameters:
argumentValues - the argument values for which the dummy argument names will be created.
Returns:
an array of dummy argument names.

hashArguments

public java.util.Hashtable hashArguments(java.lang.Class[] argumentTypes,
                                         java.lang.Object[] argumentValues)
Transform two arrays of matching argument types and argument values into a hashtable of corresponding key/value pairs, with the argumentType as the key.

Parameters:
argumentTypes - an array of argument types
argumentValues - an array of argument values
Returns:
the argument types and values represented as a hashtable

playbackMockCall

public java.lang.Object playbackMockCall(InvokedCall invokedCall,
                                         RecordedCall recordedCall)
                                  throws java.lang.Throwable
Performs the logic of playing back a recorded mock call.

Parameters:
invokedCall - the call that was invoked
recordedCall - the recorded call that matches this invoked call
Returns:
the recorded mock return type (which may be null if one was not recorded)
Throws:
java.lang.Throwable - the recorded mock exception (if one was recorded)


Copyright © 2003-2005 Virtual Mock. All Rights Reserved.