Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.tapestry5.plastic
Interface MethodInvocation

All Superinterfaces:
  AnnotationAccess, MethodInvocationResult

All Known Implementing Classes:
  AbstractMethodInvocation

    public interface MethodInvocation

extends MethodInvocationResult, AnnotationAccess

A representation of the invocation of a method that allows the behavior of the method to be advised: either by changing parameter values, or by changing the return value, or by catch or throwing different exceptions. Provides access to annotations on the advised method.

See Also:
  `MethodAdvice`

Method Summary
`java.lang.Object` | `getInstance()` The instance on which the method was originally invoked.
`InstanceContext` | `getInstanceContext()`
`java.lang.reflect.Method` | `getMethod()` Returns the method being invoked.
`java.lang.Object` | `getParameter(int index)` Returns the parameter at the given index.
`MethodInvocation` | `proceed()` Proceed with the method invocation, either chaining into the next `MethodAdvice` added to the method, or ultimately into the actual method implementation.
`MethodInvocation` | `setCheckedException(java.lang.Exception exception)` Sets the checked exception; this can be used to indicate failure for the method, or to cancel the thrown exception (by setting the exception to null).
`MethodInvocation` | `setParameter(int index, java.lang.Object newValue)` Changes a parameter value.
`MethodInvocation` | `setReturnValue(java.lang.Object returnValue)` Overrides the return value of the method.

Methods inherited from interface org.apache.tapestry5.plastic.MethodInvocationResult
`didThrowCheckedException, getCheckedException, getReturnValue, rethrow`

Methods inherited from interface org.apache.tapestry5.plastic.AnnotationAccess
`getAnnotation, hasAnnotation`

Method Detail

### getInstance

    java.lang.Object getInstance()

  The instance on which the method was originally invoked.

### getInstanceContext

    InstanceContext getInstanceContext()

### proceed

    MethodInvocation proceed()

  Proceed with the method invocation, either chaining into the next `MethodAdvice` added to the method, or ultimately into the actual method implementation. The method may throw a checked exception, which will be caught and be reported as `MethodInvocationResult.didThrowCheckedException()`.

  Returns:
    this method invocation, for a fluent API

### setReturnValue

    MethodInvocation setReturnValue(java.lang.Object returnValue)

  Overrides the return value of the method. The value provided will be cast to the actual return type (or, if the return type is a primitive value, the value will be cast to the corresponding wrapper type and then converted to a primitive).

  Overriding the return value clears any checked exception.

  Parameters:
    `returnValue` -
  Returns:
    this method invocation, for a fluent API
  Throws:
    `java.lang.NullPointerException` - if the method's return type is a primitive and null is provided

### getParameter

    java.lang.Object getParameter(int index)

  Returns the parameter at the given index. Primitive types will be wrapped as they are returned.

  Parameters:
    `index` - of parameter to access
  Returns:
    parameter value

### setParameter

    MethodInvocation setParameter(int index,
                                  java.lang.Object newValue)

  Changes a parameter value. The value will be cast to the parameter's type. For primitive types, the value will be cast to the corresponding wrapper type.

  Parameters:
    `index` - index of parameter to modify
    `newValue` - new value for parameter
  Returns:
    this method invocation, for a fluent API

### setCheckedException

    MethodInvocation setCheckedException(java.lang.Exception exception)

  Sets the checked exception; this can be used to indicate failure for the method, or to cancel the thrown exception (by setting the exception to null).

  Parameters:
    `exception` - new checked exception, or null
  Returns:
    this method invocation, for a fluent API

### getMethod

    java.lang.reflect.Method getMethod()

  Returns the method being invoked.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2012 The Apache Software Foundation.