1 // Copyright 2012 Google Inc. All Rights Reserved.
3 package com
.google
.appengine
.api
.search
.checkers
;
5 import com
.google
.apphosting
.api
.AppEngineInternal
;
8 * Checks values of {@link com.google.appengine.api.search.Cursor}.
12 public final class CursorChecker
{
15 * Checks the cursor string if provided is not empty nor too long.
17 * @param cursor the search cursor to check
18 * @return the checked cursor
19 * @throws IllegalArgumentException if the cursor is empty or is too long
21 public static String
checkCursor(String cursor
) {
23 Preconditions
.checkArgument(!cursor
.isEmpty(),
24 "cursor cannot be empty");
25 Preconditions
.checkArgument(cursor
.length() <= SearchApiLimits
.MAXIMUM_CURSOR_LENGTH
,
26 String
.format("cursor cannot be longer than %d characters",
27 SearchApiLimits
.MAXIMUM_CURSOR_LENGTH
));