All Downloads are FREE. Search and download functionalities are using the official Maven repository.

react4j.annotations.Prop Maven / Gradle / Ivy

There is a newer version: 0.81
Show 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 an abstract method that returns a prop.
 * The property is extracted from Reacts underlying props object.
 *
 * 

The method that is annotated with @Prop must also comply with the following constraints:

*
    *
  • Must not be annotated with any other react annotation
  • *
  • Must have 0 parameters
  • *
  • Must return a value
  • *
  • Must be an abstract instance method
  • *
  • Must not throw exceptions
  • *
  • Must be accessible from the same package as the class annotated by {@link ReactComponent}
  • *
*/ @Documented @Target( ElementType.METHOD ) public @interface Prop { /** * Return the name of the prop. * If the underlying method conforms to java beans accessor conventions (i.e. starts with "is" and is a boolean * or starts with "get") then the name is the same as the java bean convention dictates, otherwise the name of * the method is used as the default value for the prop. * * @return the name of the prop. */ @Nonnull String name() default ""; /** * Return enum indicating whether prop should be when component is constructed. * This influences validation when enabled and how the Builder class is created. * If set to {@link Feature#ENABLE} then the user MUST supply the prop and the builder will require the user * to specify the value. If set to {@link Feature#DISABLE} then the user can optionally supply the prop. * If set to {@link Feature#AUTODETECT} then the annotation processor will treat it as {@link Feature#DISABLE} * if theere is a corresponding {@link PropDefault} for the prop, otherwise it will be treated as * {@link Feature#ENABLE}. * * @return the flag indicating whether the prop needs to be supplied. */ Feature require() default Feature.AUTODETECT; }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy