class MetricUtils {

    protected static void pushDownPredicate(Constraints constraints, ListMetricsRequest listMetricsRequest)
    {
        Map<String, ValueSet> summary = constraints.getSummary();

        ValueSet namespaceConstraint = summary.get(NAMESPACE_FIELD);
        if (namespaceConstraint != null && namespaceConstraint.isSingleValue()) {
            listMetricsRequest.setNamespace(namespaceConstraint.getSingleValue().toString());
        }

        ValueSet metricConstraint = summary.get(METRIC_NAME_FIELD);
        if (metricConstraint != null && metricConstraint.isSingleValue()) {
            listMetricsRequest.setMetricName(metricConstraint.getSingleValue().toString());
        }

        ValueSet dimensionNameConstraint = summary.get(DIMENSION_NAME_FIELD);
        ValueSet dimensionValueConstraint = summary.get(DIMENSION_VALUE_FIELD);
        if (dimensionNameConstraint != null && dimensionNameConstraint.isSingleValue() &&
                dimensionValueConstraint != null && dimensionValueConstraint.isSingleValue()) {
            DimensionFilter filter = new DimensionFilter()
                    .withName(dimensionNameConstraint.getSingleValue().toString())
                    .withValue(dimensionValueConstraint.getSingleValue().toString());
            listMetricsRequest.setDimensions(Collections.singletonList(filter));
        }
    }

    private  MetricUtils();

}