Revision created by MOE tool push_codebase.
[gae.git] / java / src / main / com / google / appengine / api / search / checkers / QueryOnlyCustomerDocumentChecker.java
blobddaf9400a41cef59effb7b6f8a400036a0a4491a
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.search.DocumentPb;
6 import com.google.common.base.Strings;
8 /**
9 * This class performs {@link DocumentPb.Document} validity checks for search customers that only
10 * use the query API.
12 public class QueryOnlyCustomerDocumentChecker {
14 /**
15 * Checks whether a {@link DocumentPb.Document} has a valid set of fields for clients that only
16 * use the search query API.
18 * @param pb the {@link DocumentPb.Document} protocol buffer to check.
19 * @throws IllegalArgumentException if the document is invalid.
21 public static void checkValid(DocumentPb.Document pb) {
22 Preconditions.checkArgument(pb.hasId(), "Document id is not specified");
23 Preconditions.checkArgument(!Strings.isNullOrEmpty(pb.getId()), "Document id is null or empty");
24 mandatoryCheckValid(pb);