001package react4j.annotations;
002
003import java.lang.annotation.Documented;
004import java.lang.annotation.ElementType;
005import java.lang.annotation.Target;
006import javax.annotation.Nonnull;
007
008/**
009 * Identifies method that is called when the input value is specified or changes.
010 *
011 * <p>The method must also conform to the following constraints:</p>
012 * <ul>
013 * <li>Must not be annotated with any other react4j annotation</li>
014 * <li>Must have 1 parameter that matches the type of the input</li>
015 * <li>Must not return a value</li>
016 * <li>Must not be private</li>
017 * <li>Must not be public</li>
018 * <li>Must not be static</li>
019 * <li>Must not be abstract</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 in the class annotated with the {@link View} annotation as the method is not
030 *   expected to be invoked outside the view. A warning will be generated but can be suppressed by the
031 *   {@link SuppressWarnings} or {@link SuppressReact4jWarnings} annotations with a key "React4j:ProtectedMethod".
032 * </li>
033 * </ul>
034 */
035@Documented
036@Target( ElementType.METHOD )
037public @interface InputValidate
038{
039  /**
040   * Return the name of the associated input. If the value is not specified then the name
041   * will be derived assuming that the method name matches the pattern "validate[Name]"
042   *
043   * @return the name of the input.
044   */
045  @Nonnull
046  String name() default "<default>";
047}