public static QueryResultsProcessor create(Operation op){
  QueryTask task=op.getBody(QueryTask.class);
  if (Objects.equals(task.documentKind,QueryTask.KIND)) {
    ServiceDocumentQueryResult r=op.getBody(ServiceDocumentQueryResult.class);
    if (Objects.equals(task.documentKind,ODataFactoryQueryResult.KIND) || Objects.equals(task.documentKind,ServiceDocumentQueryResult.KIND)) {
      return new QueryResultsProcessor(null,r);
    }
 else {
      throw new IllegalArgumentException("Cannot create QueryResultsProcessor from a " + r.documentKind + " document");
    }
  }
 else {
    return new QueryResultsProcessor(task,task.results);
  }
}

public static QueryResultsProcessor create ( Operation op ) { QueryTask task = op . getBody ( QueryTask . class ) ; if ( Objects . equals ( task . documentKind , QueryTask . KIND ) ) { ServiceDocumentQueryResult r = op . getBody ( ServiceDocumentQueryResult . class ) ; if ( Objects . equals ( task . documentKind , ODataFactoryQueryResult . KIND ) || Objects . equals ( task . documentKind , ServiceDocumentQueryResult . KIND ) ) { return new QueryResultsProcessor ( null , r ) ; } else { throw new IllegalArgumentException ( "Cannot create QueryResultsProcessor from a " + r . documentKind + " document" ) ; } } else { return new QueryResultsProcessor ( task , task . results ) ; } }
create a queryresultsprocessor by trying to parse the operation body as either querytask or servicedocumentqueryresult or odatafactoryqueryresult .
