@SuppressWarnings("unchecked")
    public <REQ extends BasicMessage> Collection<WsCommand<REQ>> getCommands(Class<REQ> requestClass)
            throws NoCommandForMessageException {

        ArrayList<WsCommand<REQ>> results = new ArrayList<>(2);

        if (ResourceDestination.class.isAssignableFrom(requestClass)) {
            results.add((WsCommand<REQ>) resourcePathDestinationWsCommand);
        } else if (UiSessionDestination.class.isAssignableFrom(requestClass)) {
            results.add((WsCommand<REQ>) uiSessionDestinationWsCommand);
        } else if (EchoRequest.class.isAssignableFrom(requestClass)) {
            results.add((WsCommand<REQ>) echoCommand);
        }

        // some commands may also want the message sent to events
        if (EventDestination.class.isAssignableFrom(requestClass)) {
            results.add((WsCommand<REQ>) eventDestinationWsCommand);
        }

        // new commands will need to be added here

        if (results.isEmpty()) {
            throw new NoCommandForMessageException(
                    "No command found for requestClass [" + requestClass.getName() + "]");
        }

        return results;
    }
@ SuppressWarnings ( "unchecked" ) public < REQ extends BasicMessage > Collection < WsCommand < REQ > > getCommands ( Class < REQ > requestClass ) throws NoCommandForMessageException { ArrayList < WsCommand < REQ > > results = new ArrayList < > ( 2 ) ; if ( ResourceDestination . class . isAssignableFrom ( requestClass ) ) { results . add ( ( WsCommand < REQ > ) resourcePathDestinationWsCommand ) ; } else if ( UiSessionDestination . class . isAssignableFrom ( requestClass ) ) { results . add ( ( WsCommand < REQ > ) uiSessionDestinationWsCommand ) ; } else if ( EchoRequest . class . isAssignableFrom ( requestClass ) ) { results . add ( ( WsCommand < REQ > ) echoCommand ) ; } if ( EventDestination . class . isAssignableFrom ( requestClass ) ) { results . add ( ( WsCommand < REQ > ) eventDestinationWsCommand ) ; } if ( results . isEmpty ( ) ) { throw new NoCommandForMessageException ( "No command found for requestClass [" + requestClass . getName ( ) + "]" ) ; } return results ; }
Returns a collection of {@link WsCommand}s that should handle the given {@code requestClass}.

@param requestClass the type of a request for which a processing {@link WsCommand} should be found by this method
@return a collection of {@link WsCommand} objects, never {@code null}
@throws NoCommandForMessageException if no {@link WsCommand} was found