Annotation Interface WrapMethod


@Target(METHOD) @Retention(RUNTIME) public @interface WrapMethod
Allows you to wrap a whole method. To wrap individual operations within a method, including method calls, see @WrapOperation.

Your handler method receives the target method's arguments and an Operation representing the method being wrapped. You should return the same type as the wrapped method does:

 private (static) ReturnType handler(<params of the original method>,Operation<ReturnType> original)
 
When calling the original, you must pass everything before the original in your handler's parameters. You can optionally pass different values to change what the original uses.

This chains when used by multiple people, unlike @Overwrite.

If you never use the original then you risk other people's changes being silently ignored.

NOTE: While this injector in general does not support Sugar, it does have special support for using @Share to share values between wrappers and the target method.

See the wiki article for more info.

  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
     
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    int
     
    int
     
    boolean
     
    int
     
  • Element Details

    • remap

      boolean remap
      Default:
      true
    • require

      int require
      Default:
      -1
    • expect

      int expect
      Default:
      1
    • allow

      int allow
      Default:
      -1