コード例 #1
0
  public static final class Builder<OriginalInput, Output>
      implements ProcessingResultListener<OriginalInput, Output> {

    private final Counts.Builder fetch = Counts.builder();
    private final Counts.Builder processing = Counts.builder();
    private boolean hasListenerDelegationFailures = false;

    public ResultStatistics build() {
      return new ResultStatistics(fetch.build(), processing.build(), hasListenerDelegationFailures);
    }

    public void setListenerDelegationFailures(final boolean b) {
      hasListenerDelegationFailures = b;
    }

    @Override
    public void onFetchResult(final Result<FetchedItem<OriginalInput>, OriginalInput> result) {
      fetch.add(result);
    }

    @Override
    public void onProcessingResult(final Result<FetchedItem<OriginalInput>, Output> result) {
      processing.add(result);
    }
  }