Package arez.annotations
Annotation Interface OnDepsChange
Identifies method that will be invoked when the dependencies of the paired
Observe annotated method are changed.
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 abstract
- Must have either no parameters or a single parameter of type
Observer - Must not return a value
- Must not throw an exception
- Must be accessible to the class annotated by the
ArezComponentannotation. -
Should not be public as not expected to be invoked outside the component. A warning will be generated but can
be suppressed by the
SuppressWarningsorSuppressArezWarningsannotations 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
ArezComponentannotation as the method is not expected to be invoked outside the component. A warning will be generated but can be suppressed by theSuppressWarningsorSuppressArezWarningsannotations with a key "Arez:ProtectedMethod".
If the annotated method has a parameter of type Observer then the underlying Observer
instance associated with the Observe/OnDepsChange annotated method is passed to the method when
dependencies change. This is extremely useful when implementing asynchronous callbacks.
-
Optional Element Summary
Optional Elements
-
Element Details
-
name
Return the name of the paired Tracked relative to the component. The value must conform to the requirements of a java identifier. The name need not be specified. If theObserveannotated method is named "render" then this will default to being named "onRenderDepsChange".- Returns:
- the name of the paired
Observeannotated method relative to the component.
- Default:
- "<default>"
-