Annotation Interface ComponentRef


Marks a template method that returns the Component instance for the component.

The method that is annotated with this annotation must also comply with the following constraints:

  • Must not be annotated with any other arez annotation
  • Must be abstract
  • Must not throw any exceptions
  • Must return an instance of Component.
  • Must be accessible to the class annotated by the ArezComponent annotation.
  • Should not be public as not expected to be invoked outside the component. A warning will be generated but can be suppressed by the SuppressWarnings or SuppressArezWarnings annotations with a key "Arez:PublicRefMethod". 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 ArezComponent annotation as the method is not expected to be invoked outside the component. A warning will be generated but can be suppressed by the SuppressWarnings or SuppressArezWarnings annotations with a key "Arez:ProtectedMethod".