react4j.annotations.Publish 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 to mark a method that returns a value to be published in context for child components.
* The value is published with the type that matches the return type of the method.
*
* The method that is annotated with this annotation 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 not be private
* - Must not be abstract
* - Must not throw exceptions
* - Must be accessible from the same package as the class annotated by {@link View}
* -
* Should not be public as not expected to be invoked outside the view. A warning will be generated but can
* be suppressed by the {@link SuppressWarnings} or {@link SuppressReact4jWarnings} annotations with a key
* "React4j:PublicMethod". This warning is also suppressed by the annotation processor if it is implementing
* an interface method.
*
* -
* Should not be protected if in the class annotated with the {@link View} annotation as the method is not
* expected to be invoked outside the view. A warning will be generated but can be suppressed by the
* {@link SuppressWarnings} or {@link SuppressReact4jWarnings} annotations with a key "React4j:ProtectedMethod".
*
*
*/
@Documented
@Target( ElementType.METHOD )
public @interface Publish
{
/**
* Return the qualifier used to publish value to the context.
*
* @return the qualifier used to publish value to the context.
*/
@Nonnull
String qualifier() default "";
}