Interface MethodInvocation

    • Method Detail

      • getInstance

        java.lang.Object getInstance()
        The instance on which the method was originally invoked.
      • 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.