Annotation Interface OnInputChange


Identifies a method that is called when the value of one of the specified inputs is changed. Each parameter of the method is mapped to a input that is tracked. The method will be called before or after the update has occurred and will be passed the previous values of the inputs as parameters.

Each parameter is expected to be named according to the pattern "last[MyInput]", "prev[MyInput]" or "[myInput]". If name of the parameter does not follow the pattern then the name can be explicitly mapped via the InputRef annotation on a parameter.

The method must also conform to the following constraints:

  • Must not be annotated with any other react4j annotation
  • Must have 1 or more parameters. Each parameter must map to a input as described above.
  • Must not return a value
  • Must not be private
  • Must not be public
  • Must not be static
  • Must not be abstract
  • Must not throw exceptions
  • Must be accessible from the same package as the class annotated by View
  • Should not be public as not expected to be invoked outside the view. A warning will be generated but can be suppressed by the SuppressWarnings or SuppressReact4jWarnings annotations with a key "React4j:PublicMethod". 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 View annotation as the method is not expected to be invoked outside the view. A warning will be generated but can be suppressed by the SuppressWarnings or SuppressReact4jWarnings annotations with a key "React4j:ProtectedMethod".
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    Phase in which method should be invoked.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    The phase in which the method should be invoked.
  • Element Details

    • phase

      The phase in which the method should be invoked.
      Returns:
      the phase in which the method should be invoked.
      Default:
      PRE