Annotation Interface PostInverseAdd


Identifies a method that will be invoked after an inverse reference is added to a component. This method MUST be paired with a method annotated with Inverse with the same name.

If there are multiple methods annotated with this annotation then the methods declared in parent classes will be invoked first and multiple methods within a single class will be invoked in declaration order.

The method that is annotated with this annotation must comply with the additional constraints:

  • Must not be annotated with any other arez annotation
  • Must not be private
  • Must not be static
  • Must not be abstract
  • Must have have a single parameter of type that matches the related reference value
  • Must not return a value
  • Must not throw an exception
  • Must be accessible to the class annotated by the ArezComponent annotation.
  • Should not be public as not expected to be invoked outside the component. A warning will be generated but can be suppressed by the SuppressWarnings or SuppressArezWarnings annotations with a key "Arez:PublicHookMethod". This warning is also suppressed by the annotation processor if it is implementing an interface method.
  • Should not be protected if in the class annotated with the ArezComponent annotation as the method is not expected to be invoked outside the component. A warning will be generated but can be suppressed by the SuppressWarnings or SuppressArezWarnings annotations with a key "Arez:ProtectedMethod".
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Return the name of the Inverse that this method is associated with.
  • Element Details

    • name

      @Nonnull String name
      Return the name of the Inverse that this method is associated with. This value will be derived if the method name matches the pattern "on[Name]Remove", otherwise it must be specified.
      Returns:
      the name of the Inverse.
      Default:
      "<default>"