arez.annotations.OnActivate Maven / Gradle / Ivy
package arez.annotations;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
import javax.annotation.Nonnull;
/**
* Identifies method that is called when the {@link arez.ComputableValue} changes from the INACTIVE state to any other state.
*
* This method can only be associated with a {@link Memoize} annotated method that has 0 parameters.
* This limitation is in place to limit implementation complexity and because no use case for this
* functionality has been found.
*
* The method must also conform to the following constraints:
*
* - Must not be annotated with any other arez annotation
* - Must have either 0 parameters or a single parameter of type {@link arez.ComputableValue}
* - Must not return a value
* - Must not be private
* - Must not be static
* - Must not be abstract
* - Must not throw exceptions
* - Must not be for a {@link Memoize} method that has the {@link Memoize#keepAlive} parameter set to true
* - Must be accessible to the class annotated by the {@link ArezComponent} annotation.
* -
* Should not be public as not expected to be invoked outside the component. A warning will be generated but can
* be suppressed by the {@link SuppressWarnings} or {@link SuppressArezWarnings} annotations with a key
* "Arez:PublicHookMethod". 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 ArezComponent} annotation as the method is not
* expected to be invoked outside the component. A warning will be generated but can be suppressed by the
* {@link SuppressWarnings} or {@link SuppressArezWarnings} annotations with a key "Arez:ProtectedMethod".
*
*
*/
@Documented
@Target( ElementType.METHOD )
public @interface OnActivate
{
/**
* Return the name of the ComputableValue that this method is associated with.
* This value will be derived if the method name matches the pattern "on[Name]Activate",
* otherwise it must be specified.
*
* @return the name of the ComputableValue.
*/
@Nonnull
String name() default "";
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy