@ SuppressWarnings ( "unchecked" ) public < T > HandlerRegistration register ( Serializer < T > serializer ) { final HandlerRegistration reg = bindSerializerToType ( serializer , serializer . handledType ( ) ) ; if ( serializer instanceof HasImpl ) { Class [ ] impls = ( ( HasImpl ) serializer ) . implTypes ( ) ; final HandlerRegistration [ ] regs = new HandlerRegistration [ impls . length + 1 ] ; regs [ 0 ] = reg ; for ( int i = 0 ; i < impls . length ; i ++ ) { Class impl = impls [ i ] ; regs [ i + 1 ] = bindSerializerToType ( serializer , impl ) ; } return new HandlerRegistration ( ) { public void removeHandler ( ) { for ( HandlerRegistration reg : regs ) { reg . removeHandler ( ) ; } } } ; } return reg ; }
Register a serializer of the given type .