public class InvocationRecorder extends java.lang.Object implements Interceptor
InvocationRecorder recorder = new InvocationRecorder();
aspectSystem.add( new ClassPointcut( SampleHelper.class, false), recorder);
InvocationContext dummyMethodInvocation = recorder.findByTargetMethod( "dummyMethod");
assertNotNull(dummyMethodInvocation);
Constructor and Description |
---|
InvocationRecorder() |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears all currently stored invocations
|
InvocationContext |
findByInterceptedMethod(java.lang.String methodPattern)
Deprecated.
Use findByProxyMethod instead
|
InvocationContext |
findByProxyMethod(java.lang.String methodPattern)
Finds the first invocation for a given proxy method pattern.
|
InvocationContext |
findByTargetMethod(java.lang.String methodPattern)
Finds the first invocation for a given target method pattern.
|
java.util.List |
getMethodInvocationList()
Returns the list of all invocations that happened since the recorder
was added.
|
boolean |
hasRecords()
Returns true is it has at least one record
|
void |
intercept(InvocationContext invocationContext)
Performs pre and post invocation actions for the target object call.
|
java.lang.String |
toString() |
public void intercept(InvocationContext invocationContext) throws java.lang.Exception
Interceptor
intercept
in interface Interceptor
invocationContext
- provides the info about this call. Also calls interceptors in
turn according to their order in the chain. invocationContext provides access to the return value
and thrown exceptions of this call.java.lang.Exception
public java.util.List getMethodInvocationList()
public boolean hasRecords()
public void clear()
public InvocationContext findByTargetMethod(java.lang.String methodPattern)
methodPattern
- regexp pattern to run against the string representation of a methodpublic InvocationContext findByInterceptedMethod(java.lang.String methodPattern)
methodPattern
- regexp pattern to run against the string representation of a methodpublic InvocationContext findByProxyMethod(java.lang.String methodPattern)
methodPattern
- regexp pattern to run against the string representation of a methodpublic java.lang.String toString()
toString
in class java.lang.Object