Class PaginatorsClassSpec
- java.lang.Object
-
- software.amazon.awssdk.codegen.poet.paginators.PaginatorsClassSpec
-
- All Implemented Interfaces:
ClassSpec
- Direct Known Subclasses:
AsyncResponseClassSpec
,SyncResponseClassSpec
public abstract class PaginatorsClassSpec extends Object implements ClassSpec
-
-
Field Summary
Fields Modifier and Type Field 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 PoetExtension
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 Summary
Constructors Constructor Description PaginatorsClassSpec(IntermediateModel model, String c2jOperationName, PaginatorDefinition paginatorDefinition)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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 inPaginatorDefinition.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()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface software.amazon.awssdk.codegen.poet.ClassSpec
className, poetSpec, staticImports
-
-
-
-
Field Detail
-
CLIENT_MEMBER
protected static final String CLIENT_MEMBER
- See Also:
- Constant Field Values
-
REQUEST_MEMBER
protected static final String REQUEST_MEMBER
- See Also:
- Constant Field Values
-
NEXT_PAGE_FETCHER_MEMBER
protected static final String NEXT_PAGE_FETCHER_MEMBER
- See Also:
- Constant Field Values
-
HAS_NEXT_PAGE_METHOD
protected static final String HAS_NEXT_PAGE_METHOD
- See Also:
- Constant Field Values
-
NEXT_PAGE_METHOD
protected static final String NEXT_PAGE_METHOD
- See Also:
- Constant Field Values
-
RESUME_METHOD
protected static final String RESUME_METHOD
- See Also:
- Constant Field Values
-
PREVIOUS_PAGE_METHOD_ARGUMENT
protected static final String PREVIOUS_PAGE_METHOD_ARGUMENT
- See Also:
- Constant Field Values
-
RESPONSE_LITERAL
protected static final String RESPONSE_LITERAL
- See Also:
- Constant Field Values
-
LAST_SUCCESSFUL_PAGE_LITERAL
protected static final String LAST_SUCCESSFUL_PAGE_LITERAL
- See Also:
- Constant Field Values
-
model
protected final IntermediateModel model
-
c2jOperationName
protected final String c2jOperationName
-
paginatorDefinition
protected final PaginatorDefinition paginatorDefinition
-
poetExtensions
protected final PoetExtension poetExtensions
-
typeProvider
protected final TypeProvider typeProvider
-
operationModel
protected final OperationModel operationModel
-
paginationDocs
protected final PaginationDocs paginationDocs
-
-
Constructor Detail
-
PaginatorsClassSpec
public PaginatorsClassSpec(IntermediateModel model, String c2jOperationName, PaginatorDefinition paginatorDefinition)
-
-
Method Detail
-
requestType
protected com.squareup.javapoet.ClassName requestType()
- Returns:
- A Poet
ClassName
for the operation request type. Example: For ListTables operation, it will be "ListTablesRequest" class.
-
responseType
protected com.squareup.javapoet.ClassName responseType()
- Returns:
- A Poet
ClassName
for the sync operation response type. Example: For ListTables operation, it will be "ListTablesResponse" class.
-
requestClassField
protected com.squareup.javapoet.FieldSpec requestClassField()
-
nextPageFetcherClassName
protected String nextPageFetcherClassName()
-
resumeMethodBuilder
protected com.squareup.javapoet.MethodSpec.Builder resumeMethodBuilder()
-
getTypeForResultKey
protected com.squareup.javapoet.TypeName getTypeForResultKey(String singleResultKey)
-
memberModelForResponseMember
protected MemberModel memberModelForResponseMember(String input)
- Parameters:
input
- A top level or nested member in response ofc2jOperationName
.- Returns:
- The
MemberModel
of thePaginatorDefinition.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.
-
hasNextPageMethodBody
protected com.squareup.javapoet.CodeBlock hasNextPageMethodBody()
-
nextPageMethodBody
protected com.squareup.javapoet.CodeBlock nextPageMethodBody()
-
codeToGetNextPageIfOldResponseIsNotNull
protected String codeToGetNextPageIfOldResponseIsNotNull()
Generates the code to get next page by using values from old page. Sample generated code: return client.listTables(firstRequest.toBuilder().exclusiveStartTableName(response.lastEvaluatedTableName()).build());
-
constructRequestFromLastPage
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. Sample code: if responsePage string is "response" firstRequest.toBuilder().exclusiveStartTableName(response.lastEvaluatedTableName()).build()
-
fluentGetterMethodsForOutputToken
protected List<String> fluentGetterMethodsForOutputToken()
Returns a list of fluent getter methods for members inPaginatorDefinition.getOutputToken()
list. The size of list returned by this method is equal to the size ofPaginatorDefinition.getOutputToken()
list.
-
fluentGetterMethodForResponseMember
protected String fluentGetterMethodForResponseMember(String member)
Returns the fluent getter method for a single member in the response. The returned String includes the '()' after each method name. The input member can be a nested String. An example would be StreamDescription.LastEvaluatedShardId which represents LastEvaluatedShardId member in StreamDescription class. The return value for it would be "streamDescription().lastEvaluatedShardId()"- Parameters:
member
- A top level or nested member in response ofc2jOperationName
.
-
getIteratorLambdaBlock
protected com.squareup.javapoet.CodeBlock getIteratorLambdaBlock(String resultKey, MemberModel resultKeyModel)
-
-