public class NextToken extends Object
public String queryRows(Row aMeta ,
String sNextToken,
List< Row > lResults ,
IDBBackendQuery iQuery )
throws Exception
{
....
// parse the given token and retrieve its information
// as e.g. offset and page size
NextToken4Offset aNextToken = new NextToken4Offset (sNextToken);
int nOffset = aNextToken.getOffset ();
int nPageSize = aNextToken.getPageSize ();
// use such informations to start new query.
Results aResult = impl_doQuery (..., nOffset, nPageSize);
// 'max results' must count ALL possible results of a query
// independent how many items was used from that results set !
int nMaxResults = aResult.getCount ();
// pass max count of results to the token instance and
// let it calculate the next possible token ...
// The return value of those call will be the next sNextToken
// passed to this query method then.
// If method return an empty string no further results exists and
// no further query makes sense.
return aNextToken.stepNext (nMaxResults);
}
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_OFFSET |
static int |
DEFAULT_PAGESIZE |
static String |
NO_NEXT_TOKEN |
static String |
PROP_OFFSET |
static String |
PROP_PAGESIZE |
static String |
SEPARATOR |
| Modifier and Type | Method and Description |
|---|---|
String |
asString() |
String |
finish() |
int |
getOffset() |
int |
getPageSize() |
void |
parse(String sToken)
parse the given token and fill this instance.
|
void |
setOffset(int nOffset)
set the new offset for the next token to be generated by using this
instance.
|
void |
setPageSize(int nSize)
set the new page size for the next token to be generated by using this
instance.
|
String |
stepNext() |
String |
stepNext(int nMaxResults) |
public static final int DEFAULT_OFFSET
public static int DEFAULT_PAGESIZE
public static final String PROP_OFFSET
public static final String PROP_PAGESIZE
public static final String SEPARATOR
public static final String NO_NEXT_TOKEN
public void parse(String sToken) throws Exception
sToken - [IN]
the last token to be parsed here.
Can be empty or null.Exceptionpublic int getOffset()
throws Exception
Exceptionpublic void setOffset(int nOffset)
throws Exception
nOffset - [IN]
the new offset.
Has to be >= 0.Exceptionpublic int getPageSize()
throws Exception
ExceptionCopyright © 2016 as-development.net. All rights reserved.