Annotation Interface PostUpdate


@Documented @Target(METHOD) public @interface PostUpdate
Identifies a method that is called after a view is updated or re-rendered. Re-render in this circumstance means that a view has been mounted on the DOM and changes to the view are being applied to the dom. There may be zero or more methods annotated with this annotation in a view. This method is invoked in the "commit" phase using reacts componentDidUpdate() lifecycle method.

The same method may participate in several lifecycle phases by carrying their annotations. Callbacks run in declaration order, with superclasses before subclasses. Each type's interfaces are visited before its declarations, in written order with interface ancestors first and shared ancestors visited once. The first ancestor annotation for each phase reserves its position. Overrides retain that position but participate only in phases annotated on the overriding declaration; an unannotated override disables the callback. A newly added phase takes the overriding declaration's position.

The method must also conform to the following constraints:

  • Must have 0 parameters
  • Must not return a value
  • Must not be private
  • 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".