public void setMetrics(java.util.Collection<MetricDataQuery> metrics) {
        if (metrics == null) {
            this.metrics = null;
            return;
        }

        this.metrics = new com.amazonaws.internal.SdkInternalList<MetricDataQuery>(metrics);
    }
<p>
An array of <code>MetricDataQuery</code> structures that enable you to create an alarm based on the result of a
metric math expression. For each <code>PutMetricAlarm</code> operation, you must specify either
<code>MetricName</code> or a <code>Metrics</code> array.
</p>
<p>
Each item in the <code>Metrics</code> array either retrieves a metric or performs a math expression.
</p>
<p>
One item in the <code>Metrics</code> array is the expression that the alarm watches. You designate this
expression by setting <code>ReturnData</code> to true for this object in the array. For more information, see <a
href
="https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_MetricDataQuery.html">MetricDataQuery</a>.
</p>
<p>
If you use the <code>Metrics</code> parameter, you cannot include the <code>Namespace</code>,
<code>MetricName</code>, <code>Dimensions</code>, <code>Period</code>, <code>Unit</code>, <code>Statistic</code>,
or <code>ExtendedStatistic</code> parameters of <code>PutMetricAlarm</code> in the same operation. Instead, you
retrieve the metrics you are using in your math expression as part of the <code>Metrics</code> array.
</p>

@param metrics
       An array of <code>MetricDataQuery</code> structures that enable you to create an alarm based on the result
       of a metric math expression. For each <code>PutMetricAlarm</code> operation, you must specify either
       <code>MetricName</code> or a <code>Metrics</code> array.</p>
       <p>
       Each item in the <code>Metrics</code> array either retrieves a metric or performs a math expression.
       </p>
       <p>
       One item in the <code>Metrics</code> array is the expression that the alarm watches. You designate this
       expression by setting <code>ReturnData</code> to true for this object in the array. For more information,
       see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_MetricDataQuery.html">
       MetricDataQuery</a>.
       </p>
       <p>
       If you use the <code>Metrics</code> parameter, you cannot include the <code>Namespace</code>,
       <code>MetricName</code>, <code>Dimensions</code>, <code>Period</code>, <code>Unit</code>,
       <code>Statistic</code>, or <code>ExtendedStatistic</code> parameters of <code>PutMetricAlarm</code> in the
       same operation. Instead, you retrieve the metrics you are using in your math expression as part of the
       <code>Metrics</code> array.
aws-java-sdk-cloudwatch/src/main/java/com/amazonaws/services/cloudwatch/model/PutMetricAlarmRequest.java