User Tools

Site Tools


tutorial:mixin_redirectors

Mixin redirectors

introduction

Redirectors are methods that can replace method invocations, field accesses, object creation, and instanceof checks. Redirectors are declared by @Redirect annotations and generally look like this:

  1. @Redirect(method = "${signatureOfMethodInWhichToRedirect}",
  2. at = @At(value = "${injectionPointReference}", target = "${signature}"))
  3. public ReturnType redirectSomeMethod(Arg0Type arg0, Arg1Type arg1) {
  4. MyClass.doMyComputations();
  5.  
  6. return computeSomethingElse();
  7. }

Refer to the specific redirection tutorials for information about injection point references:

tutorial/mixin_redirectors.txt · Last modified: 2022/04/24 07:22 by jummit