public static QueryTask.QuerySpecification buildTaskStatusQuerySpec(final Class taskClass,final TaskState.TaskStage... stages){
  checkArgument(stages != null && stages.length >= 1,"stages.length must be >= 1");
  String fieldName=findStageFieldName(taskClass);
  if (null == fieldName) {
    throw new IllegalArgumentException(String.format("%s does not have a member of type %s",taskClass,TaskState.class));
  }
  QueryTask.Query stageQuery=buildTaskStateQuery(String.format(STAGE_FIELD_NAME_FORMAT,fieldName),stages);
  return buildQuerySpec(taskClass,stageQuery);
}

public static QueryTask . QuerySpecification buildTaskStatusQuerySpec ( final Class taskClass , final TaskState . TaskStage ... stages ) { checkArgument ( stages != null && stages . length >= 1 , "stages.length must be >= 1" ) ; String fieldName = findStageFieldName ( taskClass ) ; if ( null == fieldName ) { throw new IllegalArgumentException ( String . format ( "%s does not have a member of type %s" , taskClass , TaskState . class ) ) ; } QueryTask . Query stageQuery = buildTaskStateQuery ( String . format ( STAGE_FIELD_NAME_FORMAT , fieldName ) , stages ) ; return buildQuerySpec ( taskClass , stageQuery ) ; }
builds a query specification which will query for service instances of type taskclass with the stage field one of the values passed in as a parameter .
