001package react4j.annotations;
002
003import java.lang.annotation.Documented;
004import java.lang.annotation.ElementType;
005import java.lang.annotation.Target;
006
007/**
008 * Identify a method that can be invoked to schedule the view for re-rendering.
009 * This annotation is rarely required as the underlying arez reactivity infrastructure
010 * should be used in preference to this method. The method primarily exists for backwards
011 * compatibility with earlier versions of the framework.
012 *
013 * <p>The method must also conform to the following constraints:</p>
014 * <ul>
015 * <li>Must not be annotated with any other react4j annotation</li>
016 * <li>Must be abstract</li>
017 * <li>Must have 0 parameters</li>
018 * <li>Must not return a value</li>
019 * <li>Must not be static</li>
020 * <li>Must not throw exceptions</li>
021 * <li>Must be accessible from the same package as the class annotated by {@link View}</li>
022 * <li>
023 *   Should not be public as not expected to be invoked outside the view. A warning will be generated but can
024 *   be suppressed by the {@link SuppressWarnings} or {@link SuppressReact4jWarnings} annotations with a key
025 *   "React4j:PublicMethod". 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 enclosed in the class annotated with the {@link View} annotation as the
030 *   method is not expected to be invoked outside the view. A warning will be generated but can be suppressed
031 *   by the {@link SuppressWarnings} or {@link SuppressReact4jWarnings} annotations with a
032 *   key "React4j:ProtectedMethod".
033 * </li>
034 * </ul>
035 */
036@Documented
037@Target( ElementType.METHOD )
038public @interface ScheduleRender
039{
040  /**
041   * Determines whether the view will invoke the <code>shouldComponentUpdate()</code> before invoking the render method.
042   *
043   * @return true to skip "shouldViewUpdate" phase, false otherwise.
044   */
045  boolean skipShouldViewUpdate() default true;
046}