001package arez.annotations; 002 003import java.lang.annotation.Documented; 004import java.lang.annotation.ElementType; 005import java.lang.annotation.Target; 006 007/** 008 * Marks a template method that returns the {@link arez.ArezContext} instance for component. 009 * 010 * <p>The method that is annotated with this annotation must also comply with the following constraints:</p> 011 * <ul> 012 * <li>Must not be annotated with any other arez annotation</li> 013 * <li>Must not have any parameters</li> 014 * <li>Must be abstract</li> 015 * <li>Must not throw any exceptions</li> 016 * <li>Must return an instance of {@link arez.ArezContext}.</li> 017 * <li>Must be accessible to the class annotated by the {@link ArezComponent} annotation.</li> 018 * <li> 019 * Should not be public as not expected to be invoked outside the component. A warning will be generated but can 020 * be suppressed by the {@link SuppressWarnings} or {@link SuppressArezWarnings} annotations with a key 021 * "Arez:PublicRefMethod". This warning is also suppressed by the annotation processor if it is implementing 022 * an interface method. 023 * </li> 024 * <li> 025 * Should not be protected if in the class annotated with the {@link ArezComponent} annotation as the method is not 026 * expected to be invoked outside the component. A warning will be generated but can be suppressed by the 027 * {@link SuppressWarnings} or {@link SuppressArezWarnings} annotations with a key "Arez:ProtectedMethod". 028 * </li> 029 * </ul> 030 */ 031@Documented 032@Target( ElementType.METHOD ) 033public @interface ContextRef 034{ 035}