Annotation Interface ComponentDependency


Methods and fields marked with this annotation are dependencies of the component. If the dependency is disposed then the component takes an action to cascade the dispose or null the property referencing the dependency. The dependency MUST implement the DisposeNotifier interface.

It should be noted that it is preferable for the field that defines the dependency 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 dependency if it is not annotated with ComponentDependency or CascadeDispose.

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 except Observable
  • If not annotated with Observable then must be final
  • Must have 0 parameters
  • Must return a value that implements DisposeNotifier or is annotated with ArezComponent. This will be checked at compile-time unless validateTypeAtRuntime() set to true.
  • Must not be private
  • Must not be static
  • If not annotated with Observable then must not be abstract
  • Must not throw exceptions
  • Must be accessible to the class annotated by the ArezComponent annotation.

If the element annotated is a field then the field must comply with the additional constraints:

  • Must be final
  • Must be a type that implements DisposeNotifier or is annotated with ArezComponent
  • Must not be private
  • Must not be static
  • Must be accessible to the class annotated by the ArezComponent annotation.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    The action to take when dependency is disposed.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Return the action to take when the dependency is disposed.
    boolean
    Return true and the value of the annotated field will be validated at runtime rather than at compile time.
  • Element Details