001package arez.annotations;
002
003import java.lang.annotation.Documented;
004import java.lang.annotation.ElementType;
005import java.lang.annotation.Target;
006
007/**
008 * Annotation to identify method that is invoked after the component is constructed.
009 * The method is invoked after the component classes constructor has been invoked and all
010 * the Arez elements have been constructed and scheduled but before the scheduler has been
011 * triggered. Thus this method is invoked before the first execution of any observers or
012 * {@link Memoize#keepAlive()} computable values.
013 *
014 * <p>If there are multiple methods annotated with this annotation then the methods declared in parent
015 * classes will be invoked first and multiple methods within a single class will be invoked in declaration
016 * order.</p>
017 *
018 * <p>The method that is annotated with this annotation must comply with the additional constraints:</p>
019 * <ul>
020 * <li>Must not be annotated with any other arez annotation except {@link Action}</li>
021 * <li>Must have 0 parameters</li>
022 * <li>Must not return a value</li>
023 * <li>Must not be private</li>
024 * <li>Must not be static</li>
025 * <li>Must not be abstract</li>
026 * <li>Must not throw exceptions</li>
027 * <li>Must be accessible to the class annotated by the {@link ArezComponent} annotation.</li>
028 * <li>
029 *   Should not be public as not expected to be invoked outside the component. A warning will be generated but can
030 *   be suppressed by the {@link SuppressWarnings} or {@link SuppressArezWarnings} annotations with a key
031 *   "Arez:PublicLifecycleMethod". This warning is also suppressed by the annotation processor if it is implementing
032 *   an interface method.
033 * </li>
034 * <li>
035 *   Should not be protected if in the class annotated with the {@link ArezComponent} annotation as the method is not
036 *   expected to be invoked outside the component. A warning will be generated but can be suppressed by the
037 *   {@link SuppressWarnings} or {@link SuppressArezWarnings} annotations with a key "Arez:ProtectedMethod".
038 * </li>
039 * </ul>
040 */
041@Documented
042@Target( ElementType.METHOD )
043public @interface PostConstruct
044{
045}