final Batch<RestRequestBatchKey, Response<Object>> batch, final Set<Object> ids, final Set<PathSpec> fields, Function<Request<?>, RequestContext> requestContextProvider) { final BatchGetEntityRequestBuilder<K, RT> builder = new BatchGetEntityRequestBuilder<>(_baseUriTemplate, _resourceSpec, _requestOptions); builder.setHeaders(_headers); _queryParams.forEach((key, value) -> builder.setParam(key, value)); _pathKeys.forEach((key, value) -> builder.pathKey(key, value)); builder.ids((Set<K>)ids); if (fields != null && !fields.isEmpty()) { builder.fields(fields.toArray(new PathSpec[fields.size()])); final BatchGetEntityRequest<K, RT> batchGet = builder.build();
final BatchGetEntityRequestBuilder<K, T> builder = new BatchGetEntityRequestBuilder<K, T>(request.getBaseUriTemplate(), request.getResponseDecoder(), request.getResourceSpec(), request.getRequestOptions()); builder.ids(batch.getValue()); for (Map.Entry<String, Object> param : request.getQueryParamsObjects().entrySet()) builder.setParam(param.getKey(), param.getValue()); builder.setHeader(header.getKey(), header.getValue()); KeyMapper.TargetHostHints.setRequestContextTargetHost(context, batch.getKey()); scatterGatherRequests.add(new KVRequestInfo<K, EntityResponse<T>>(builder.build(), context));
return new BatchGetEntityRequestBuilder(batchRequest.getBaseUriTemplate(), batchRequest.getResourceSpec(), batchRequest.getRequestOptions()).ids(keys);
@SuppressWarnings({"unchecked"}) @Override public RB ids(Collection<K> ids) { return (RB) super.ids(ids); }
@SuppressWarnings({"unchecked"}) @Override public RB setParam(String key, Object value) { return (RB) super.setParam(key, value); }
@SuppressWarnings({"unchecked"}) @Override public RB pathKey(String name, Object value) { return (RB) super.pathKey(name, value); }
@SuppressWarnings({"unchecked"}) @Override public RB fields(PathSpec... fieldPaths) { return (RB) super.fields(fieldPaths); }
@SuppressWarnings({"unchecked"}) @Override public RB setHeader(String key, String value) { return (RB) super.setHeader(key, value); } }
public BatchGetEntityRequestBuilder<K, V> fields(PathSpec... fieldPaths) { addFields(fieldPaths); return this; } }
public BatchGetEntityRequestBuilder<K, V> ids(Collection<K> ids) { addKeys(ids); return this; }
@SuppressWarnings({"unchecked"}) @Override public RB ids(K... ids) { return (RB) super.ids(ids); }
@SuppressWarnings("unchecked") public BatchGetEntityRequestBuilder<K, V> ids(K... ids) { return ids(Arrays.asList(ids)); }