View Javadoc

1   package cz.cuni.amis.pogamut.base.communication.worldview.listener.annotation;
2   
3   import java.lang.annotation.ElementType;
4   import java.lang.annotation.Retention;
5   import java.lang.annotation.RetentionPolicy;
6   import java.lang.annotation.Target;
7   
8   import cz.cuni.amis.pogamut.base.communication.worldview.IWorldView;
9   import cz.cuni.amis.pogamut.base.communication.worldview.object.IWorldObjectEvent;
10  import cz.cuni.amis.pogamut.base.communication.worldview.object.WorldObjectId;
11  
12  /**
13   * Used by {@link AnnotationListenerRegistrator} to register level E listener 
14   * ({@link IWorldView#addObjectListener(WorldObjectId, Class, cz.cuni.amis.pogamut.base.communication.worldview.object.IWorldObjectListener)} 
15   * for the annotated method. The annotated method must have 1 parameter of {@link IWorldObjectEvent}.
16   * <p><p>
17   * The listeners are created by calling {@link AnnotationListenerRegistrator#addListeners()} and removed by 
18   * calling {@link AnnotationListenerRegistrator#removeListeners()}.
19   * 
20   * @author Jimmy
21   */
22  @Target(value = { ElementType.METHOD })
23  @Retention(value = RetentionPolicy.RUNTIME)
24  public @interface ObjectEventListener {
25  
26  	/**
27  	 * Class implementing {@link WorldObjectId}, the class must have a constructor with 1 String parameter.
28  	 * @return
29  	 */
30  	Class<? extends WorldObjectId> idClass();
31  	
32  	/**
33  	 * Id of the object you want to listen to.
34  	 * @return
35  	 * @see IWorldView#addObjectListener(WorldObjectId, Class, cz.cuni.amis.pogamut.base.communication.worldview.object.IWorldObjectListener)
36  	 */
37  	String objectId();
38  	
39  	/**
40  	 * Events you want the method to receive.
41  	 * @return
42  	 * @see IWorldView#addObjectListener(WorldObjectId, Class, cz.cuni.amis.pogamut.base.communication.worldview.object.IWorldObjectListener)
43  	 */
44  	Class<?> eventClass();
45  	
46  }