private static void registerMiddlewareHandler ( Object handler ) { if ( handler instanceof MiddlewareHandler ) { // register the middleware handler if it is enabled. if ( ( ( MiddlewareHandler ) handler ) . isEnabled ( ) ) { ( ( MiddlewareHandler ) handler ) . register ( ) ; } } }
Detect if the handler is a MiddlewareHandler instance . If yes then register it .