001package react4j.annotations; 002 003import java.lang.annotation.Documented; 004import java.lang.annotation.ElementType; 005import java.lang.annotation.Target; 006 007/** 008 * Identifies a method that is called immediately prior to render method. 009 * There may be 0 or more methods annotated with this annotation in a view. 010 * 011 * <p>This method will be invoked immediately prior to @Render annotated method. If there are multiple 012 * methods annotated by this annotation then the methods will be invoked in the order specified by the sortOrder 013 * parameter.</p> 014 * 015 * <p>The method must also conform to the following constraints:</p> 016 * <ul> 017 * <li>Must not be annotated with any other react4j annotation</li> 018 * <li>Must have 0 parameters</li> 019 * <li>Must not return a value</li> 020 * <li>Must not be private</li> 021 * <li>Must not be public</li> 022 * <li>Must not be static</li> 023 * <li>Must not be abstract</li> 024 * <li>Must not throw exceptions</li> 025 * <li>Must be accessible from the same package as the class annotated by {@link View}</li> 026 * <li> 027 * Should not be public as not expected to be invoked outside the view. A warning will be generated but can 028 * be suppressed by the {@link SuppressWarnings} or {@link SuppressReact4jWarnings} annotations with a key 029 * "React4j:PublicMethod". This warning is also suppressed by the annotation processor if it is implementing 030 * an interface method. 031 * </li> 032 * <li> 033 * Should not be protected if in the class annotated with the {@link View} annotation as the method is not 034 * expected to be invoked outside the view. A warning will be generated but can be suppressed by the 035 * {@link SuppressWarnings} or {@link SuppressReact4jWarnings} annotations with a key "React4j:ProtectedMethod". 036 * </li> 037 * </ul> 038 */ 039@Documented 040@Target( ElementType.METHOD ) 041public @interface PreRender 042{ 043 /** 044 * The parameter to determine the ordering of PreRender annotated methods if multiple methods are defined. 045 * Lower values occur earlier, if multiple methods have the same sortOrder then sorting order is undefined. 046 * 047 * @return the sortOrder. 048 */ 049 int sortOrder() default SortOrder.APPLICATION; 050}