Annotation Interface Action


@Documented @Target(METHOD) public @interface Action
Methods marked with this annotation are invoked in an Arez transaction.

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 final
  • Must not be abstract
  • Must be accessible to the class annotated by the ArezComponent annotation.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    Does the action mutate state or not.
    Return the name of the Action relative to the component.
    boolean
    Return true if the parameters should be reported to the Arez spy subsystem.
    boolean
    Return true if the return value of the action (if any) should be reported to the Arez spy subsystem.
    boolean
    True if the action should always start a new transaction.
    boolean
    Flag indicating whether the code should verify that at least one read or write occurs within the scope of the action.
  • Element Details

    • name

      @Nonnull String name
      Return the name of the Action relative to the component. The value must conform to the requirements of a java identifier. The name must also be unique across Observables, Memoizes and Actions within the scope of the ArezComponent annotated element.
      Returns:
      the name of the Action relative to the component.
      Default:
      "<default>"
    • mutation

      boolean mutation
      Does the action mutate state or not.
      Returns:
      true if method should be wrapped in READ_WRITE transaction, false if it should it should be wrapped in READ_ONLY transaction.
      Default:
      true
    • reportParameters

      Return true if the parameters should be reported to the Arez spy subsystem. It is useful to disable reporting for large, circular or just uninteresting parameters to the spy infrastructure.
      Returns:
      true to report the parameters, false otherwise.
      Default:
      true
    • reportResult

      boolean reportResult
      Return true if the return value of the action (if any) should be reported to the Arez spy subsystem. It is useful to disable reporting for large, circular or just uninteresting parameters to the spy infrastructure.
      Returns:
      true to report the return value, false otherwise.
      Default:
      true
    • requireNewTransaction

      True if the action should always start a new transaction. A false value indicates that the action will use the invoking transaction if present, otherwise will create a new transaction to invoke action.
      Returns:
      true if the action will create a new transaction, false if it will use the existing transaction if present.
      Default:
      false
    • verifyRequired

      Flag indicating whether the code should verify that at least one read or write occurs within the scope of the action.
      Returns:
      true to verify action reads or writes observable data.
      Default:
      true