arez.annotations.Computed 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;
/**
* Methods marked with this annotation are ComputedValues within Arez.
*
* The return value should be derived from other Observables within the Arez system
* and the value returned by the method should not change unless the state of the other
* {@link Observable}s change. The method is wrapped in a READ_ONLY transaction and
* thus can not modify other state in the system.
*
* The method that is annotated with @Computed must comply with the additional constraints:
*
* - Must not be annotated with any other arez annotation
* - Must have 0 parameters
* - Must return a value
* - Must not be private
* - Must not be static
* - Must not be final
* - Must not be abstract
* - Must not throw exceptions
*
*/
@Documented
@Target( ElementType.METHOD )
public @interface Computed
{
/**
* Return the name of the ComputedValue relative to the component.
* The value must conform to the requirements of a java identifier.
* The name must also be unique across {@link Observable}s,
* {@link Computed}s and {@link Action}s within the scope of the
* {@link ArezComponent} annotated element.
*
* @return the name of the ComputedValue relative to the component.
*/
@Nonnull
String name() default "";
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy