class AdminGenerateLogBloomCache implements JsonRpcMethod {

  @Override
  public JsonRpcResponse response(final JsonRpcRequestContext requestContext) {
    final Optional<BlockParameter> startBlockParam =
        requestContext.getOptionalParameter(0, BlockParameter.class);
    final long startBlock;
    if (startBlockParam.isEmpty() || startBlockParam.get().isEarliest()) {
      startBlock = 0;
    } else if (startBlockParam.get().getNumber().isPresent()) {
      startBlock = startBlockParam.get().getNumber().get();
    } else {
      // latest, pending
      startBlock = Long.MAX_VALUE;
    }

    final Optional<BlockParameter> stopBlockParam =
        requestContext.getOptionalParameter(1, BlockParameter.class);
    final long stopBlock;
    if (stopBlockParam.isEmpty()) {
      if (startBlockParam.isEmpty()) {
        stopBlock = -1L;
      } else {
        stopBlock = Long.MAX_VALUE;
      }
    } else if (stopBlockParam.get().isEarliest()) {
      stopBlock = 0;
    } else if (stopBlockParam.get().getNumber().isPresent()) {
      stopBlock = stopBlockParam.get().getNumber().get();
    } else {
      // latest, pending
      stopBlock = Long.MAX_VALUE;
    }

    return new JsonRpcSuccessResponse(
        requestContext.getRequest().getId(),
        blockchainQueries
            .getTransactionLogBloomCacher()
            .map(cacher -> cacher.requestCaching(startBlock, stopBlock))
            .orElse(null));
  }

  public  AdminGenerateLogBloomCache(final BlockchainQueries blockchainQueries);

}