/*
 * @author Ranides Atterwim {@literal <ranides@gmail.com>}
 * @copyright Ranides Atterwim
 * @license WTFPL
 * @url http://ranides.net/projects/assira
 */
package net.ranides.assira.events;

import java.lang.annotation.Documented;
import static java.lang.annotation.ElementType.METHOD;
import java.lang.annotation.Retention;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Target;

/**
 * Annotation used by {@link EventListener} to tell name of EventRouter, which
 * should execute annotated method.
 *
 * There are few special router names which does not use real routers,
 * but define special semantic (execute in UI thread, execute later)
 *
 * @author Ranides Atterwim {@literal <ranides@gmail.com>}
 */
@Retention(RUNTIME)
@Target(METHOD)
@Documented
public @interface EventHandler {

    /**
     * Special behaviour: execute method inside UI thread
     */
    String UI = "$awt";

    /**
     * Special behaviour: execute method inside UI thread and block EventObserver until finished.
     */
    String UI_WAIT = "$awt:wait";

    /**
     * Special behaviour: use TaskInvoker#later
     * It uses "delay" property.
     */
    String LATER = "$later";

    /**
     * Special behaviour: use TaskInvoker#lazy
     * It uses "delay" property.
     */
    String LAZY = "$lazy";

    /**
     * Name of non-anounymous EventRouter which should execute method.
     * Could be one of special values, if we want to use special execution strategy.
     *
     * @return String
     */
    String router() default "";

    /**
     * Delay is used by LATER and LAZY execution strategies.
     *
     * @return int
     */
    int delay() default 0;
    
}
