Package arez.annotations
Annotation Interface CascadeDispose
Methods and fields annotated by this annotation should be disposed when the component is disposed.
The dispose occurs after the
PreDispose method.
It should be noted that it is preferable for the field that defines the contained component is marked
with this annotation rather than the method accessor. The reason is that the annotation processor
will issue a warning if a field that the processor identifies as a potential contained component if it is
not annotated with AutoObserve, CascadeDispose or ComponentDependency.
If the element annotated is a method then the method must comply with the additional constraints:
- Must not be annotated with any other arez annotation other than
ReferenceorObservable - Must have 0 parameters
- The type of the field must implement
Disposableor must be annotated byArezComponent - Must not be private
- Must not be static
- Must not be abstract unless the method is annotated with
ReferenceorObservablein which case it MUST be abstract - Must not throw exceptions
- Must be accessible to the class annotated by the
ArezComponentannotation.
If the element annotated is a field then the field must comply with the additional constraints:
- Must not be private
- Must not be static
- The type of the field must implement
Disposableor must be annotated byArezComponent - Must be accessible to the class annotated by the
ArezComponentannotation. - Should not be public. A warning will be generated but can be suppressed by the
SuppressWarningsorSuppressArezWarningsannotations with a key "Arez:PublicField". -
Should not be protected if in the class annotated with the
ArezComponentannotation as the field is not expected to be accessed outside the component. A warning will be generated but can be suppressed by theSuppressWarningsorSuppressArezWarningsannotations with a key "Arez:ProtectedField".
This annotation is only supported on elements contained within a type annotated by
ArezComponent or ArezComponentLike. Other usages will fail compilation.