All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.azure.cosmos.FeedResponseDiagnostics Maven / Gradle / Ivy

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

package com.azure.cosmos;

import com.azure.cosmos.implementation.QueryMetrics;
import org.apache.commons.lang3.StringUtils;

import java.util.Map;

public class FeedResponseDiagnostics {

    private Map queryMetricsMap;

    FeedResponseDiagnostics(Map queryMetricsMap) {
        this.queryMetricsMap = queryMetricsMap;
    }

    Map getQueryMetricsMap() {
        return queryMetricsMap;
    }

    FeedResponseDiagnostics setQueryMetricsMap(Map queryMetricsMap) {
        this.queryMetricsMap = queryMetricsMap;
        return this;
    }

    /**
     * Returns the textual representation of feed response metrics
     *
     * @return Textual representation of feed response metrics
     */
    @Override
    public String toString() {
        if (queryMetricsMap == null || queryMetricsMap.isEmpty()) {
            return StringUtils.EMPTY;
        }
        StringBuilder stringBuilder = new StringBuilder();
        queryMetricsMap.forEach((key, value) -> stringBuilder.append(key)
                                                    .append("=")
                                                    .append(value.toString())
                                                    .append("\n"));
        return stringBuilder.toString();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy