public abstract class PaginatorsClassSpec extends Object implements ClassSpec
Modifier and Type | Field and Description |
---|---|
protected String |
c2jOperationName |
protected static String |
CLIENT_MEMBER |
protected static String |
HAS_NEXT_PAGE_METHOD |
protected static String |
LAST_SUCCESSFUL_PAGE_LITERAL |
protected IntermediateModel |
model |
protected static String |
NEXT_PAGE_FETCHER_MEMBER |
protected static String |
NEXT_PAGE_METHOD |
protected OperationModel |
operationModel |
protected PaginationDocs |
paginationDocs |
protected PaginatorDefinition |
paginatorDefinition |
protected PoetExtensions |
poetExtensions |
protected static String |
PREVIOUS_PAGE_METHOD_ARGUMENT |
protected static String |
REQUEST_MEMBER |
protected static String |
RESPONSE_LITERAL |
protected static String |
RESUME_METHOD |
protected TypeProvider |
typeProvider |
Constructor and Description |
---|
PaginatorsClassSpec(IntermediateModel model,
String c2jOperationName,
PaginatorDefinition paginatorDefinition) |
Modifier and Type | Method and Description |
---|---|
protected String |
codeToGetNextPageIfOldResponseIsNotNull()
Generates the code to get next page by using values from old page.
|
protected String |
constructRequestFromLastPage(String responsePage)
Generates the code to construct a request object from the last successful page
by setting the fields required to get the next page.
|
protected String |
fluentGetterMethodForResponseMember(String member)
Returns the fluent getter method for a single member in the response.
|
protected List<String> |
fluentGetterMethodsForOutputToken()
Returns a list of fluent getter methods for members in
PaginatorDefinition.getOutputToken() list. |
protected com.squareup.javapoet.CodeBlock |
getIteratorLambdaBlock(String resultKey,
MemberModel resultKeyModel) |
protected com.squareup.javapoet.TypeName |
getTypeForResultKey(String singleResultKey) |
protected com.squareup.javapoet.CodeBlock |
hasNextPageMethodBody() |
protected MemberModel |
memberModelForResponseMember(String input) |
protected String |
nextPageFetcherClassName() |
protected com.squareup.javapoet.CodeBlock |
nextPageMethodBody() |
protected com.squareup.javapoet.FieldSpec |
requestClassField() |
protected com.squareup.javapoet.ClassName |
requestType() |
protected com.squareup.javapoet.ClassName |
responseType() |
protected com.squareup.javapoet.MethodSpec.Builder |
resumeMethodBuilder() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
className, poetSpec, staticImports
protected static final String CLIENT_MEMBER
protected static final String REQUEST_MEMBER
protected static final String NEXT_PAGE_FETCHER_MEMBER
protected static final String HAS_NEXT_PAGE_METHOD
protected static final String NEXT_PAGE_METHOD
protected static final String RESUME_METHOD
protected static final String PREVIOUS_PAGE_METHOD_ARGUMENT
protected static final String RESPONSE_LITERAL
protected static final String LAST_SUCCESSFUL_PAGE_LITERAL
protected final IntermediateModel model
protected final String c2jOperationName
protected final PaginatorDefinition paginatorDefinition
protected final PoetExtensions poetExtensions
protected final TypeProvider typeProvider
protected final OperationModel operationModel
protected final PaginationDocs paginationDocs
public PaginatorsClassSpec(IntermediateModel model, String c2jOperationName, PaginatorDefinition paginatorDefinition)
protected com.squareup.javapoet.ClassName requestType()
ClassName
for the operation request type.
Example: For ListTables operation, it will be "ListTablesRequest" class.protected com.squareup.javapoet.ClassName responseType()
ClassName
for the sync operation response type.
Example: For ListTables operation, it will be "ListTablesResponse" class.protected com.squareup.javapoet.FieldSpec requestClassField()
protected String nextPageFetcherClassName()
protected com.squareup.javapoet.MethodSpec.Builder resumeMethodBuilder()
protected com.squareup.javapoet.TypeName getTypeForResultKey(String singleResultKey)
protected MemberModel memberModelForResponseMember(String input)
input
- A top level or nested member in response of c2jOperationName
.MemberModel
of the PaginatorDefinition.getResultKey()
. If input value is nested,
then member model of the last child shape is returned.
For example, if input is StreamDescription.Shards, then the return value is "Shard" which is the member model for
the Shards.protected com.squareup.javapoet.CodeBlock hasNextPageMethodBody()
protected com.squareup.javapoet.CodeBlock nextPageMethodBody()
protected String codeToGetNextPageIfOldResponseIsNotNull()
protected String constructRequestFromLastPage(String responsePage)
protected List<String> fluentGetterMethodsForOutputToken()
PaginatorDefinition.getOutputToken()
list.
The size of list returned by this method is equal to the size of PaginatorDefinition.getOutputToken()
list.protected String fluentGetterMethodForResponseMember(String member)
member
- A top level or nested member in response of c2jOperationName
.protected com.squareup.javapoet.CodeBlock getIteratorLambdaBlock(String resultKey, MemberModel resultKeyModel)
Copyright © 2020. All rights reserved.