Annotation Interface OnActivate


Identifies method that is called when the ComputableValue changes from the INACTIVE state to any other state.

This method can only be associated with a Memoize annotated method that has 0 parameters. This limitation is in place to limit implementation complexity and because no use case for this functionality has been found.

The method must also conform to the following constraints:

  • Must not be annotated with any other arez annotation
  • Must have either 0 parameters or a single parameter of type ComputableValue
  • Must not return a value
  • Must not be private
  • Must not be static
  • Must not be abstract
  • Must not throw exceptions
  • Must not be for a Memoize method that has the Memoize.keepAlive() parameter set to true
  • 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 ComputableValue that this method is associated with.
  • Element Details

    • name

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