Revision created by MOE tool push_codebase.
[gae.git] / java / src / main / com / google / appengine / api / search / checkers / QueryOnlyCustomerDocumentChecker.java
blobe5cc6414d3a9ce60a6c90037273afc349e7169a3
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;
9 /**
10 * This class performs {@link DocumentPb.Document} validity checks for search customers that only
11 * use the query API.
13 @AppEngineInternal
14 public class QueryOnlyCustomerDocumentChecker {
16 /**
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);