@Test public void testRegister() throws Exception { Assert.assertEquals("Expected empty dispatch map.", 0, handler.getDispatchMap().size()); NameCallback nameCallback = new NameCallback(">|<"); NameCallbackHandler nameCallbackHandler = new NameCallbackHandler("joe"); handler.register(NameCallback.class, nameCallbackHandler); Assert.assertEquals("Expected a single registered callback handler.", 1, handler.getDispatchMap().size()); }
public DispatchCallbackHandler register(Class<? extends Callback> callbackClass, CallbackHandler callbackHandler) { if (callbackClass == null) { throw new NullPointerException("callbackClass"); } if (callbackHandler == null) { throw new NullPointerException("callbackHandler"); } dispatchMap.put(callbackClass, callbackHandler); return this; }
DispatchCallbackHandler implements CallbackHandler { public DispatchCallbackHandler register(Class<? extends Callback> callbackClass, CallbackHandler callbackHandler) { if (callbackClass == null) { throw new NullPointerException("callbackClass"); } if (callbackHandler == null) { throw new NullPointerException("callbackHandler"); } dispatchMap.put(callbackClass, callbackHandler); return this; } }
DispatchCallbackHandler implements CallbackHandler { public DispatchCallbackHandler register(Class<? extends Callback> callbackClass, CallbackHandler callbackHandler) { if (callbackClass == null) { throw new NullPointerException("callbackClass"); } if (callbackHandler == null) { throw new NullPointerException("callbackHandler"); } dispatchMap.put(callbackClass, callbackHandler); return this; }  }
DispatchCallbackHandler implements CallbackHandler { public DispatchCallbackHandler register(Class<? extends Callback> callbackClass, CallbackHandler callbackHandler) { if (callbackClass == null) { throw new NullPointerException("callbackClass"); } if (callbackHandler == null) { throw new NullPointerException("callbackHandler"); } dispatchMap.put(callbackClass, callbackHandler); return this; }  DispatchCallbackHandler register(Class<? extends Callback> callbackClass, CallbackHandler callbackHandler); DispatchCallbackHandler registerAll(TypedCallbackHandlerMap callbackHandlers); CallbackHandler unregister(Class<? extends Callback> callbackClass); @Override void handle(Callback[] callbacks); }
DispatchCallbackHandler implements CallbackHandler { public DispatchCallbackHandler register(Class<? extends Callback> callbackClass, CallbackHandler callbackHandler) { if (callbackClass == null) { throw new NullPointerException("callbackClass"); } if (callbackHandler == null) { throw new NullPointerException("callbackHandler"); } dispatchMap.put(callbackClass, callbackHandler); return this; }  DispatchCallbackHandler register(Class<? extends Callback> callbackClass, CallbackHandler callbackHandler); DispatchCallbackHandler registerAll(TypedCallbackHandlerMap callbackHandlers); CallbackHandler unregister(Class<? extends Callback> callbackClass); @Override void handle(Callback[] callbacks);  }