cz.cuni.amis.pogamut.base.communication.worldview.listener.annotation
Class AnnotationListenerRegistrator

Package class diagram package AnnotationListenerRegistrator
java.lang.Object
  extended by cz.cuni.amis.pogamut.base.communication.worldview.listener.annotation.AnnotationListenerRegistrator
All Implemented Interfaces:
IListenerRegistrator

public class AnnotationListenerRegistrator
extends Object
implements IListenerRegistrator

Author:
Jimmy

Constructor Summary
AnnotationListenerRegistrator(Object obj, IWorldView worldView, Logger log)
           
 
Method Summary
 void addListeners()
          Introspect all object's methods and register various listeners based on EventListener, etc... annotations.
static WorldObjectId getId(Method method, Class idClass, String id)
          Tries to instantiate ID class of 'idClass' with 'id' as an identifier.
static WorldObjectId getId(Method method, ObjectEventListener annotation)
          Returns a new WorldObjectId for the given 'annotation'.
static WorldObjectId getId(Method method, ObjectListener annotation)
          Returns a new WorldObjectId for the given 'annotation'.
static ListenerLevel getListenerLevel(Method method)
          Returns listener level that is gained from the method's annotation.
 int getListenersCount()
           
 Logger getLog()
           
static boolean isStaticMethod(Method method)
          Tells whether 'method' is static.
 void removeListeners()
          Removes (unregister) all the listeners the registrator has created.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnnotationListenerRegistrator

public AnnotationListenerRegistrator(Object obj,
                                     IWorldView worldView,
                                     Logger log)
Method Detail

getId

public static WorldObjectId getId(Method method,
                                  Class idClass,
                                  String id)
Tries to instantiate ID class of 'idClass' with 'id' as an identifier. It first looks for constructor having only one string parameter and then for static method "idClass get(String)".

Parameters:
method -
idClass -
id -
Returns:

getId

public static WorldObjectId getId(Method method,
                                  ObjectListener annotation)
Returns a new WorldObjectId for the given 'annotation'.

Parameters:
method -
annotation -
Returns:
id instance

isStaticMethod

public static boolean isStaticMethod(Method method)
Tells whether 'method' is static.

Parameters:
method -
Returns:

getId

public static WorldObjectId getId(Method method,
                                  ObjectEventListener annotation)
Returns a new WorldObjectId for the given 'annotation'.

Parameters:
method -
annotation -
Returns:
id instance

getListenerLevel

public static ListenerLevel getListenerLevel(Method method)
Returns listener level that is gained from the method's annotation.

Parameters:
method -
Returns:
listener level of the method

addListeners

public void addListeners()
                  throws ListenersAlreadyRegisteredException
Introspect all object's methods and register various listeners based on EventListener, etc... annotations.

Specified by:
addListeners in interface IListenerRegistrator
Parameters:
obj -
Throws:
ListenersAlreadyRegisteredException

getListenersCount

public int getListenersCount()

removeListeners

public void removeListeners()
Description copied from interface: IListenerRegistrator
Removes (unregister) all the listeners the registrator has created.

Specified by:
removeListeners in interface IListenerRegistrator

getLog

public Logger getLog()


Copyright © 2012 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.