001package arez.annotations; 002 003import java.lang.annotation.Documented; 004import java.lang.annotation.ElementType; 005import java.lang.annotation.Target; 006 007/** 008 * Annotate the method that will be overridden to return the value of ArezComponent.name(). 009 * This is only useful when a class potentially has multiple {@link ArezComponent} annotated subclasses. 010 * This method is used when manually setting up debug context and you want it to align with the concrete 011 * implementations. However often {@link ComponentNameRef} is a better solution. If not specified Arez will 012 * generate a private method if needed. 013 * 014 * <p>The method that is annotated with this annotation must comply with the additional constraints:</p> 015 * <ul> 016 * <li>Must not be annotated with any other arez annotation</li> 017 * <li>Must have 0 parameters</li> 018 * <li>Must return a String</li> 019 * <li>Must be abstract</li> 020 * <li>Must not throw exceptions</li> 021 * <li>Must be accessible to the class annotated by the {@link ArezComponent} annotation.</li> 022 * <li> 023 * Should not be public as not expected to be invoked outside the component. A warning will be generated but can 024 * be suppressed by the {@link SuppressWarnings} or {@link SuppressArezWarnings} annotations with a key 025 * "Arez:PublicRefMethod". This warning is also suppressed by the annotation processor if it is implementing 026 * an interface method. 027 * </li> 028 * <li> 029 * Should not be protected if in the class annotated with the {@link ArezComponent} annotation as the method is not 030 * expected to be invoked outside the component. A warning will be generated but can be suppressed by the 031 * {@link SuppressWarnings} or {@link SuppressArezWarnings} annotations with a key "Arez:ProtectedMethod". 032 * </li> 033 * </ul> 034 */ 035@Documented 036@Target( ElementType.METHOD ) 037public @interface ComponentTypeNameRef 038{ 039}