1 package com
.google
.appengine
.api
.search
.checkers
;
3 import static com
.google
.appengine
.api
.search
.checkers
.DocumentChecker
.mandatoryCheckValid
;
5 import com
.google
.apphosting
.api
.AppEngineInternal
;
6 import com
.google
.apphosting
.api
.search
.DocumentPb
;
7 import com
.google
.common
.base
.Strings
;
10 * This class performs {@link DocumentPb.Document} validity checks for search customers that only
14 public class QueryOnlyCustomerDocumentChecker
{
17 * Checks whether a {@link DocumentPb.Document} has a valid set of fields for clients that only
18 * use the search query API.
20 * @param pb the {@link DocumentPb.Document} protocol buffer to check.
21 * @throws IllegalArgumentException if the document is invalid.
23 public static void checkValid(DocumentPb
.Document pb
) {
24 Preconditions
.checkArgument(pb
.hasId(), "Document id is not specified");
25 Preconditions
.checkArgument(!Strings
.isNullOrEmpty(pb
.getId()), "Document id is null or empty");
26 mandatoryCheckValid(pb
);