Guest User

Untitled

a guest
Jul 16th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. ##ActionHandlerModule.java
  2. @Override
  3. protected final void configure() {
  4. // This will only get installed once due to equals/hashCode override.
  5. install( new ServerDispatchModule() );
  6.  
  7. configureHandlers();
  8. }
  9.  
  10. ##ServerDispatchModule
  11. public ServerDispatchModule() {
  12. this( AbstractDispatch.class, DefaultActionHandlerRegistry.class );
  13. }
  14.  
  15. public ServerDispatchModule( Class<? extends Dispatch> dispatchClass ) {
  16. this( dispatchClass, DefaultActionHandlerRegistry.class );
  17. }
  18.  
  19. public ServerDispatchModule( Class<? extends Dispatch> dispatchClass,
  20. Class<? extends ActionHandlerRegistry> actionHandlerRegistryClass ) {
  21. this.dispatchClass = dispatchClass;
  22. this.actionHandlerRegistryClass = actionHandlerRegistryClass;
  23. }
  24.  
  25. @Override
  26. protected final void configure() {
  27. bind( ActionHandlerRegistry.class ).to( getActionHandlerRegistryClass() ).in( Singleton.class );
  28. bind( Dispatch.class ).to( getDispatchClass() );
  29.  
  30. // This will bind registered handlers to the registry.
  31. if ( InstanceActionHandlerRegistry.class.isAssignableFrom( getActionHandlerRegistryClass() ) )
  32. requestStaticInjection( ActionHandlerLinker.class );
  33. }
Add Comment
Please, Sign In to add comment