Interface MethodAccessorFactory

All Known Subinterfaces:
Implementation.Context, Implementation.Context.ExtractableView
All Known Implementing Classes:
Implementation.Context.Default, Implementation.Context.Disabled, Implementation.Context.ExtractableView.AbstractBase, MethodAccessorFactory.Illegal

public interface MethodAccessorFactory
A factory for creating method proxies for an auxiliary type. Such proxies are required to allow a type to call methods of a second type that are usually not accessible for the first type. This strategy is also adapted by the Java compiler that creates accessor methods for example to implement inner classes.
  • Method Details

    • registerAccessorFor

      Registers an accessor method for a Implementation.SpecialMethodInvocation which cannot itself be triggered invoked directly from outside a type. The method is registered on the instrumented type with package-private visibility, similarly to a Java compiler's accessor methods.
      Parameters:
      specialMethodInvocation - The special method invocation.
      accessType - The required access type.
      Returns:
      The accessor method for invoking the special method invocation.
    • registerGetterFor

      Registers a getter for the given FieldDescription which might itself not be accessible from outside the class. The returned getter method defines the field type as its return type, does not take any arguments and is of package-private visibility, similarly to the Java compiler's accessor methods. If the field is static, this accessor method is also static.
      Parameters:
      fieldDescription - The field which is to be accessed.
      accessType - The required access type.
      Returns:
      A getter method for the given field.
    • registerSetterFor

      Registers a setter for the given FieldDescription which might itself not be accessible from outside the class. The returned setter method defines the field type as its only argument type, returns void and is of package-private visibility, similarly to the Java compiler's accessor methods. If the field is static, this accessor method is also static.
      Parameters:
      fieldDescription - The field which is to be accessed.
      accessType - The required access type.
      Returns:
      A setter method for the given field.