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

react4j.annotations.PropDefault 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 the default value for a prop.
 * The annotation can be applied to a static field or static method on the component.
 * The field or method is then accessed when initializing the default props for the component.
 *
 * 

If a method is annotated with the @PropDefault 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 @Prop annotated method
  • *
  • Must be a static method
  • *
  • Must not be private
  • *
  • Must not throw exceptions
  • *
* *

If a field is annotated with the @PropDefault annotation then it must also * comply with the following constraints:

*
    *
  • Must have the same type as the associated @Prop 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 ReactComponent}
  • *
*/ @Documented @Target( { ElementType.METHOD, ElementType.FIELD } ) public @interface PropDefault { /** * Return the name of the associated prop. * *

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 prop. */ @Nonnull String name() default ""; }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy