question: @ Nullable private GridRestRequest createRestRequest ( GridNioSession ses , GridClientMessage msg ) { GridRestRequest restReq = null ; if ( msg instanceof GridClientAuthenticationRequest ) { GridClientAuthenticationRequest req = ( GridClientAuthenticationRequest ) msg ; restReq = new GridRestTaskRequest ( ) ; restReq . command ( NOOP ) ; restReq . credentials ( req . credentials ( ) ) ; } else if ( msg instanceof GridClientCacheRequest ) { GridClientCacheRequest req = ( GridClientCacheRequest ) msg ; GridRestCacheRequest restCacheReq = new GridRestCacheRequest ( ) ; restCacheReq . cacheName ( req . cacheName ( ) ) ; restCacheReq . cacheFlags ( req . cacheFlagsOn ( ) ) ; restCacheReq . key ( req . key ( ) ) ; restCacheReq . value ( req . value ( ) ) ; restCacheReq . value2 ( req . value2 ( ) ) ; Map vals = req . values ( ) ; if ( vals != null ) restCacheReq . values ( new HashMap < Object , Object > ( vals ) ) ; restCacheReq . command ( cacheCmdMap . get ( req . operation ( ) ) ) ; restReq = restCacheReq ; } else if ( msg instanceof GridClientTaskRequest ) { GridClientTaskRequest req = ( GridClientTaskRequest ) msg ; GridRestTaskRequest restTaskReq = new GridRestTaskRequest ( ) ; restTaskReq . command ( EXE ) ; restTaskReq . taskName ( req . taskName ( ) ) ; restTaskReq . params ( Arrays . asList ( req . argument ( ) ) ) ; restReq = restTaskReq ; } else if ( msg instanceof GridClientTopologyRequest ) { GridClientTopologyRequest req = ( GridClientTopologyRequest ) msg ; GridRestTopologyRequest restTopReq = new GridRestTopologyRequest ( ) ; restTopReq . includeMetrics ( req . includeMetrics ( ) ) ; restTopReq . includeAttributes ( req . includeAttributes ( ) ) ; if ( req . nodeId ( ) != null ) { restTopReq . command ( NODE ) ; restTopReq . nodeId ( req . nodeId ( ) ) ; } else if ( req . nodeIp ( ) != null ) { restTopReq . command ( NODE ) ; restTopReq . nodeIp ( req . nodeIp ( ) ) ; } else restTopReq . command ( TOPOLOGY ) ; restReq = restTopReq ; } if ( restReq != null ) { restReq . destinationId ( msg . destinationId ( ) ) ; restReq . clientId ( msg . clientId ( ) ) ; restReq . sessionToken ( msg . sessionToken ( ) ) ; restReq . address ( ses . remoteAddress ( ) ) ; } return restReq ; }
target:  Creates a REST request object from client TCP binary packet.