Annotation Interface ComponentStateRef


Annotate the method that will be overridden to return true if the component is in the specified state. This is useful when the component must validate methods are only called in certain states or to change behaviour based on state (i.e. Avoid causing side-effects when disposing).

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

  • May appear zero or more times on a component
  • Must not be annotated with any other arez annotation
  • Must have 0 parameters
  • Must return a boolean
  • Must be abstract
  • Must not throw exceptions
  • 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:PublicRefMethod". 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 component state which will cause the annotated method to return true.
  • Element Details

    • value

      @Nonnull State value
      Return the component state which will cause the annotated method to return true.
      Returns:
      the component state which will cause annotated method to return true.
      Default:
      READY