de.lmu.ifi.dbs.elki.utilities
Class HandlerList<H>
java.lang.Object
de.lmu.ifi.dbs.elki.utilities.HandlerList<H>
- Type Parameters:
H
- Parent class/interface for all handlers
public final class HandlerList<H>
- extends Object
Manages a list of handlers for objects. Handlers are appended to a list in
sequence, and when querying, the last added handler will be used where the
query object can be cast to the handlers restriction class.
Method Summary |
H |
getHandler(Object o)
Find a matching handler for the given object |
void |
insertHandler(Class<?> restrictionClass,
H handler)
Insert a handler to the beginning of the stack. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
handlers
private ArrayList<Pair<Class<?>,H>> handlers
- List with registered Handlers. The list is kept in backwards order, that is
the later entrys take precedence.
HandlerList
public HandlerList()
insertHandler
public void insertHandler(Class<?> restrictionClass,
H handler)
- Insert a handler to the beginning of the stack.
- Parameters:
restrictionClass
- restriction classhandler
- handler
getHandler
public H getHandler(Object o)
- Find a matching handler for the given object
- Parameters:
o
- object to find handler for
- Returns:
- handler for the object. null if no handler was found.