public synchronized void addHandler ( Class iface , Object handler ) { try { iface . cast ( handler ) ; } catch ( Exception e ) { throw new IllegalArgumentException ( "Handler: " + handler . getClass ( ) . getName ( ) + " does not implement: " + iface . getName ( ) ) ; } if ( contract . getInterfaces ( ) . get ( iface . getSimpleName ( ) ) == null ) { throw new IllegalArgumentException ( "Interface: " + iface . getName ( ) + " is not a part of this Contract" ) ; } if ( contract . getPackage ( ) == null ) { setContractPackage ( iface ) ; } handlers . put ( iface . getSimpleName ( ) , handler ) ; }
Associates the handler instance with the given IDL interface . Replaces an existing handler for this iface if one was previously registered .