react4j.annotations.InputDefault Maven / Gradle / Ivy
The newest version!
package react4j.annotations;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
import javax.annotation.Nonnull;
/**
* Annotation used to specify the default value for a input.
* The annotation can be applied to a static field or static method on the view.
* The field or method is then accessed when initializing the default inputs for the view.
*
* If a method is annotated with this annotation then it must also comply with the following constraints:
*
* - Must have 0 parameters
* - Must return a value with the same type as the associated {@link Input @Input} annotated method
* - Must be a static method
* - Must not be private
* - Must not throw exceptions
*
*
* If a field is annotated with this annotation then it must also comply with the following constraints:
*
* - Must have the same type as the associated {@link Input @Input} annotated method
* - Must be a static field
* - Must be a final field
* - Must not be private
* - Must be accessible from the same package as the class annotated by {@link View}
*
*/
@Documented
@Target( { ElementType.METHOD, ElementType.FIELD } )
public @interface InputDefault
{
/**
* Return the name of the associated input.
*
* If the annotation is applied to a method, this value will be derived if the method name matches
* the pattern "get[Name]Default", otherwise it must be specified.
*
* If the annotation is applied to a field, this value will be derived if the field name matches
* the pattern "DEFAULT_[NAME]", otherwise it must be specified.
*
* @return the name of the input.
*/
@Nonnull
String name() default "";
}