Skip to content

Commit

Permalink
Explicitly specify type in code-snippet
Browse files Browse the repository at this point in the history
  • Loading branch information
anuchandy committed Jan 6, 2020
1 parent ee078a8 commit 5363af6
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,32 +164,34 @@ public void pagedFluxFromPagedFlux() {
intResponse.getContinuationToken(),
null);

final Supplier<PageRetriever<String, PagedResponse<String>>> provider = new Supplier<>() {
@Override
public PageRetriever<String, PagedResponse<String>> get() {
return (continuationToken, pageSize) -> {
Flux<PagedResponse<Integer>> flux = (continuationToken == null)
? intPagedFlux.byPage()
: intPagedFlux.byPage(continuationToken);
return flux.map(responseMapper);
};
}
};
final Supplier<PageRetriever<String, PagedResponse<String>>> provider
= new Supplier<PageRetriever<String, PagedResponse<String>>>() {
@Override
public PageRetriever<String, PagedResponse<String>> get() {
return (continuationToken, pageSize) -> {
Flux<PagedResponse<Integer>> flux = (continuationToken == null)
? intPagedFlux.byPage()
: intPagedFlux.byPage(continuationToken);
return flux.map(responseMapper);
};
}
};
PagedFlux<String> strPagedFlux = PagedFlux.create(provider);

// Create a PagedFlux from a PagedFlux with all exceptions mapped to a specific exception.
final PagedFlux<Integer> pagedFlux = createAnInstance();
final Supplier<PageRetriever<String, PagedResponse<Integer>>> eprovider = new Supplier<>() {
@Override
public PageRetriever<String, PagedResponse<Integer>> get() {
return (continuationToken, pageSize) -> {
Flux<PagedResponse<Integer>> flux = (continuationToken == null)
? pagedFlux.byPage()
: pagedFlux.byPage(continuationToken);
return flux.onErrorMap(t -> new PaginationException(t));
};
}
};
final Supplier<PageRetriever<String, PagedResponse<Integer>>> eprovider
= new Supplier<PageRetriever<String, PagedResponse<Integer>>>() {
@Override
public PageRetriever<String, PagedResponse<Integer>> get() {
return (continuationToken, pageSize) -> {
Flux<PagedResponse<Integer>> flux = (continuationToken == null)
? pagedFlux.byPage()
: pagedFlux.byPage(continuationToken);
return flux.onErrorMap(t -> new PaginationException(t));
};
}
};
final PagedFlux<Integer> exceptionMappedPagedFlux = PagedFlux.create(eprovider);
// END: com.azure.core.http.rest.pagedflux.create.decoration
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Flux<FilePage> getFilePages(FileContinuationToken token) {
FileShareServiceClient client = null; // Initialize client

Supplier<PageRetriever<FileContinuationToken, FilePage>> pageRetrieverProvider
= new Supplier<>() {
= new Supplier<PageRetriever<FileContinuationToken, FilePage>>() {
@Override
public PageRetriever<FileContinuationToken, FilePage> get() {
return (continuationToken, pageSize) -> client.getFilePages(continuationToken);
Expand Down

0 comments on commit 5363af6

Please sign in to comment.