org.spockframework.runtime.extension
Class MethodInvocation

java.lang.Object
  extended by org.spockframework.runtime.extension.MethodInvocation
All Implemented Interfaces:
IMethodInvocation

public class MethodInvocation
extends java.lang.Object
implements IMethodInvocation

Author:
Peter Niederwieser

Constructor Summary
MethodInvocation(FeatureInfo feature, IterationInfo iteration, java.lang.Object sharedInstance, java.lang.Object instance, java.lang.Object target, MethodInfo method, java.lang.Object[] arguments)
           
 
Method Summary
 java.lang.Object[] getArguments()
          Returns the arguments for this method invocation.
 FeatureInfo getFeature()
          Returns the feature which this method invocation belongs to (if any).
 java.lang.Object getInstance()
          Returns the Specification instance for the current iteration.
 IterationInfo getIteration()
          Return the iteration which this method invocation belongs to (if any).
 MethodInfo getMethod()
          Returns the method invoked by this method invocation.
 java.lang.Object getSharedInstance()
          Returns the Specification instance for @Shared fields.
 SpecInfo getSpec()
          Returns the specification which this method invocation belongs to.
 java.lang.Object getTarget()
          Returns the target (receiver) of this method invocation.
protected  void invokeTargetMethod()
           
 void proceed()
          Proceeds with the method call.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MethodInvocation

public MethodInvocation(FeatureInfo feature,
                        IterationInfo iteration,
                        java.lang.Object sharedInstance,
                        java.lang.Object instance,
                        java.lang.Object target,
                        MethodInfo method,
                        java.lang.Object[] arguments)
Method Detail

getSpec

public SpecInfo getSpec()
Description copied from interface: IMethodInvocation
Returns the specification which this method invocation belongs to.

Specified by:
getSpec in interface IMethodInvocation
Returns:
the specification which this method invocation belongs to

getFeature

public FeatureInfo getFeature()
Description copied from interface: IMethodInvocation
Returns the feature which this method invocation belongs to (if any). Differs from MethodInfo.getFeature() in that it reflects the dynamic picture. For example, when a setup method is invoked, this method will return the corresponding feature, whereas MethodInfo.getFeature() will return null.

Specified by:
getFeature in interface IMethodInvocation
Returns:
the feature which this method invocation belongs to

getIteration

public IterationInfo getIteration()
Description copied from interface: IMethodInvocation
Return the iteration which this method invocation belongs to (if any). Executing a feature results in at least one but possibly more iterations (e.g. for a data-driven feature).

Specified by:
getIteration in interface IMethodInvocation
Returns:
the iteration which this method invocation belongs to

getSharedInstance

public java.lang.Object getSharedInstance()
Description copied from interface: IMethodInvocation
Returns the Specification instance for @Shared fields.

Specified by:
getSharedInstance in interface IMethodInvocation
Returns:
the Specification instance for @Shared fields

getInstance

public java.lang.Object getInstance()
Description copied from interface: IMethodInvocation
Returns the Specification instance for the current iteration.

Specified by:
getInstance in interface IMethodInvocation
Returns:
the Specification instance for the current iteration

getTarget

public java.lang.Object getTarget()
Description copied from interface: IMethodInvocation
Returns the target (receiver) of this method invocation. In case of a static method call, a Class instance is returned.

Specified by:
getTarget in interface IMethodInvocation
Returns:
the target (receiver) of this method invocation

getMethod

public MethodInfo getMethod()
Description copied from interface: IMethodInvocation
Returns the method invoked by this method invocation.

Specified by:
getMethod in interface IMethodInvocation
Returns:
the method invoked by this method invocation

getArguments

public java.lang.Object[] getArguments()
Description copied from interface: IMethodInvocation
Returns the arguments for this method invocation.

Specified by:
getArguments in interface IMethodInvocation
Returns:
the arguments for this method invocation

proceed

public void proceed()
             throws java.lang.Throwable
Description copied from interface: IMethodInvocation
Proceeds with the method call. Always call this method unless you want to suppress the method call.

Specified by:
proceed in interface IMethodInvocation
Throws:
java.lang.Throwable - any exception thrown by the method call

invokeTargetMethod

protected void invokeTargetMethod()
                           throws java.lang.Throwable
Throws:
java.lang.Throwable


Copyright © 2013. All rights reserved