net.customware.gwt.dispatch.server
Class LazyActionHandlerRegistry

java.lang.Object
  extended by net.customware.gwt.dispatch.server.LazyActionHandlerRegistry
All Implemented Interfaces:
ActionHandlerRegistry, ClassActionHandlerRegistry
Direct Known Subclasses:
GuiceLazyActionHandlerRegistry

public class LazyActionHandlerRegistry
extends Object
implements ClassActionHandlerRegistry

This is a lazy-loading implementation of the registry. It will only create action handlers when they are first used. All ActionHandler implementations must have a public, default constructor.

Author:
David Peterson

Constructor Summary
LazyActionHandlerRegistry()
           
 
Method Summary
<A extends Action<R>,R extends Result>
void
addHandlerClass(Class<A> actionClass, Class<? extends ActionHandler<A,R>> handlerClass)
          Registers the specified ActionHandler class with the registry.
 void clearHandlers()
          Clears all registered handlers from the registry.
protected  ActionHandler<?,?> createInstance(Class<? extends ActionHandler<?,?>> handlerClass)
           
<A extends Action<R>,R extends Result>
ActionHandler<A,R>
findHandler(A action)
          Searches the registry and returns the first handler which supports the specied action, or null if none is available.
<A extends Action<R>,R extends Result>
void
removeHandlerClass(Class<A> actionClass, Class<? extends ActionHandler<A,R>> handlerClass)
          Removes any registration of the specified class, as well as any instances which have been created.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LazyActionHandlerRegistry

public LazyActionHandlerRegistry()
Method Detail

addHandlerClass

public <A extends Action<R>,R extends Result> void addHandlerClass(Class<A> actionClass,
                                                                   Class<? extends ActionHandler<A,R>> handlerClass)
Description copied from interface: ClassActionHandlerRegistry
Registers the specified ActionHandler class with the registry. The class will only

Specified by:
addHandlerClass in interface ClassActionHandlerRegistry
Parameters:
actionClass - The action class the handler handles.
handlerClass - The handler class.

removeHandlerClass

public <A extends Action<R>,R extends Result> void removeHandlerClass(Class<A> actionClass,
                                                                      Class<? extends ActionHandler<A,R>> handlerClass)
Description copied from interface: ClassActionHandlerRegistry
Removes any registration of the specified class, as well as any instances which have been created.

Specified by:
removeHandlerClass in interface ClassActionHandlerRegistry

findHandler

public <A extends Action<R>,R extends Result> ActionHandler<A,R> findHandler(A action)
Description copied from interface: ActionHandlerRegistry
Searches the registry and returns the first handler which supports the specied action, or null if none is available.

Specified by:
findHandler in interface ActionHandlerRegistry
Parameters:
action - The action.
Returns:
The handler.

createInstance

protected ActionHandler<?,?> createInstance(Class<? extends ActionHandler<?,?>> handlerClass)

clearHandlers

public void clearHandlers()
Description copied from interface: ActionHandlerRegistry
Clears all registered handlers from the registry.

Specified by:
clearHandlers in interface ActionHandlerRegistry


Copyright © 2011 customware.net. All Rights Reserved.