package org.blaazinsoftware.centaur.service;

import com.google.appengine.api.search.Cursor;
import com.google.appengine.api.search.OperationResult;
import com.google.appengine.api.search.checkers.Preconditions;

import java.io.Serializable;
import java.util.Collection;
import java.util.Collections;

/**
 * @author Randy May
 *         Date: 15-04-09
 */
public class SearchResults <T> implements Serializable {

    private final OperationResult operationResult;
    private final Collection<T> results;
    private final long numberFound;
    private final int numberReturned;
    private final Cursor cursor;

    protected SearchResults(OperationResult operationResult, Collection<T> results, long numberFound, int numberReturned, Cursor cursor) {
        this.operationResult = (OperationResult) Preconditions.checkNotNull(operationResult, "operation result cannot be null");
        this.results = Collections.unmodifiableCollection((Collection) Preconditions.checkNotNull(results, "search results cannot be null"));
        this.numberFound = numberFound;
        this.numberReturned = numberReturned;
        this.cursor = cursor;
    }

    public OperationResult getOperationResult() {
        return operationResult;
    }

    public Collection<T> getResults() {
        return results;
    }

    public long getNumberFound() {
        return numberFound;
    }

    public int getNumberReturned() {
        return numberReturned;
    }

    public Cursor getCursor() {
        return cursor;
    }
}

@@ -145,71 +145,8 @@
 ult;
-%0Aimport com.google.appengine.api.search.checkers.Preconditions;
 %0A%0Aim
@@ -204,38 +204,8 @@
 ion;
-%0Aimport java.util.Collections;
 %0A%0A/*
@@ -666,95 +666,84 @@
     
-this.operationResult = (OperationResult) Preconditions.checkNotNull(operationResult, %22o
+if (null == operationResult) %7B%0A            throw new NullPointerException(%22O
 pera
@@ -747,17 +747,17 @@
 eration 
-r
+R
 esult ca
@@ -784,116 +784,141 @@
     
-this.r
+%7D%0A        this.operationR
 esult
-s
  = 
-Collections.unmodifiableCollection((Collection) Preconditions.checkNotNull(results, %22s
+operationResult;%0A        if (null == results) %7B%0A            throw new NullPointerException(%22S
 earch 
-r
+R
 esul
@@ -936,17 +936,58 @@
 e null%22)
-)
+;%0A        %7D%0A        this.results = results
 ;%0A      

Remove usage of unsupported Class.