/* * Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.iotsitewise.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.protocol.StructuredPojo; import com.amazonaws.protocol.ProtocolMarshaller; /** *
* Contains an asset metric property. With metrics, you can calculate aggregate functions, such as an average, maximum, * or minimum, as specified through an expression. A metric maps several values to a single value (such as a sum). *
*
* The maximum number of dependent/cascading variables used in any one metric calculation is 10. Therefore, a
* root metric can have up to 10 cascading metrics in its computational dependency tree. Additionally, a metric
* can only have a data type of DOUBLE
and consume properties with data types of INTEGER
or
* DOUBLE
.
*
* For more information, see Metrics in the * IoT SiteWise User Guide. *
* * @see AWS API * Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class Metric implements Serializable, Cloneable, StructuredPojo { /** ** The mathematical expression that defines the metric aggregation function. You can specify up to 10 variables per * expression. You can specify up to 10 functions per expression. *
** For more information, see Quotas in the IoT SiteWise * User Guide. *
*/ private String expression; /** ** The list of variables used in the expression. *
*/ private java.util.List
* The window (time interval) over which IoT SiteWise computes the metric's aggregation expression. IoT SiteWise
* computes one data point per window
.
*
* The processing configuration for the given metric property. You can configure metrics to be computed at the edge * or in the Amazon Web Services Cloud. By default, metrics are forwarded to the cloud. *
*/ private MetricProcessingConfig processingConfig; /** ** The mathematical expression that defines the metric aggregation function. You can specify up to 10 variables per * expression. You can specify up to 10 functions per expression. *
** For more information, see Quotas in the IoT SiteWise * User Guide. *
* * @param expression * The mathematical expression that defines the metric aggregation function. You can specify up to 10 * variables per expression. You can specify up to 10 functions per expression. ** For more information, see Quotas in the IoT * SiteWise User Guide. */ public void setExpression(String expression) { this.expression = expression; } /** *
* The mathematical expression that defines the metric aggregation function. You can specify up to 10 variables per * expression. You can specify up to 10 functions per expression. *
** For more information, see Quotas in the IoT SiteWise * User Guide. *
* * @return The mathematical expression that defines the metric aggregation function. You can specify up to 10 * variables per expression. You can specify up to 10 functions per expression. ** For more information, see Quotas in the IoT * SiteWise User Guide. */ public String getExpression() { return this.expression; } /** *
* The mathematical expression that defines the metric aggregation function. You can specify up to 10 variables per * expression. You can specify up to 10 functions per expression. *
** For more information, see Quotas in the IoT SiteWise * User Guide. *
* * @param expression * The mathematical expression that defines the metric aggregation function. You can specify up to 10 * variables per expression. You can specify up to 10 functions per expression. ** For more information, see Quotas in the IoT * SiteWise User Guide. * @return Returns a reference to this object so that method calls can be chained together. */ public Metric withExpression(String expression) { setExpression(expression); return this; } /** *
* The list of variables used in the expression. *
* * @return The list of variables used in the expression. */ public java.util.List* The list of variables used in the expression. *
* * @param variables * The list of variables used in the expression. */ public void setVariables(java.util.Collection* The list of variables used in the expression. *
** NOTE: This method appends the values to the existing list (if any). Use * {@link #setVariables(java.util.Collection)} or {@link #withVariables(java.util.Collection)} if you want to * override the existing values. *
* * @param variables * The list of variables used in the expression. * @return Returns a reference to this object so that method calls can be chained together. */ public Metric withVariables(ExpressionVariable... variables) { if (this.variables == null) { setVariables(new java.util.ArrayList* The list of variables used in the expression. *
* * @param variables * The list of variables used in the expression. * @return Returns a reference to this object so that method calls can be chained together. */ public Metric withVariables(java.util.Collection
* The window (time interval) over which IoT SiteWise computes the metric's aggregation expression. IoT SiteWise
* computes one data point per window
.
*
window
.
*/
public void setWindow(MetricWindow window) {
this.window = window;
}
/**
*
* The window (time interval) over which IoT SiteWise computes the metric's aggregation expression. IoT SiteWise
* computes one data point per window
.
*
window
.
*/
public MetricWindow getWindow() {
return this.window;
}
/**
*
* The window (time interval) over which IoT SiteWise computes the metric's aggregation expression. IoT SiteWise
* computes one data point per window
.
*
window
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Metric withWindow(MetricWindow window) {
setWindow(window);
return this;
}
/**
* * The processing configuration for the given metric property. You can configure metrics to be computed at the edge * or in the Amazon Web Services Cloud. By default, metrics are forwarded to the cloud. *
* * @param processingConfig * The processing configuration for the given metric property. You can configure metrics to be computed at * the edge or in the Amazon Web Services Cloud. By default, metrics are forwarded to the cloud. */ public void setProcessingConfig(MetricProcessingConfig processingConfig) { this.processingConfig = processingConfig; } /** ** The processing configuration for the given metric property. You can configure metrics to be computed at the edge * or in the Amazon Web Services Cloud. By default, metrics are forwarded to the cloud. *
* * @return The processing configuration for the given metric property. You can configure metrics to be computed at * the edge or in the Amazon Web Services Cloud. By default, metrics are forwarded to the cloud. */ public MetricProcessingConfig getProcessingConfig() { return this.processingConfig; } /** ** The processing configuration for the given metric property. You can configure metrics to be computed at the edge * or in the Amazon Web Services Cloud. By default, metrics are forwarded to the cloud. *
* * @param processingConfig * The processing configuration for the given metric property. You can configure metrics to be computed at * the edge or in the Amazon Web Services Cloud. By default, metrics are forwarded to the cloud. * @return Returns a reference to this object so that method calls can be chained together. */ public Metric withProcessingConfig(MetricProcessingConfig processingConfig) { setProcessingConfig(processingConfig); return this; } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getExpression() != null) sb.append("Expression: ").append(getExpression()).append(","); if (getVariables() != null) sb.append("Variables: ").append(getVariables()).append(","); if (getWindow() != null) sb.append("Window: ").append(getWindow()).append(","); if (getProcessingConfig() != null) sb.append("ProcessingConfig: ").append(getProcessingConfig()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof Metric == false) return false; Metric other = (Metric) obj; if (other.getExpression() == null ^ this.getExpression() == null) return false; if (other.getExpression() != null && other.getExpression().equals(this.getExpression()) == false) return false; if (other.getVariables() == null ^ this.getVariables() == null) return false; if (other.getVariables() != null && other.getVariables().equals(this.getVariables()) == false) return false; if (other.getWindow() == null ^ this.getWindow() == null) return false; if (other.getWindow() != null && other.getWindow().equals(this.getWindow()) == false) return false; if (other.getProcessingConfig() == null ^ this.getProcessingConfig() == null) return false; if (other.getProcessingConfig() != null && other.getProcessingConfig().equals(this.getProcessingConfig()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getExpression() == null) ? 0 : getExpression().hashCode()); hashCode = prime * hashCode + ((getVariables() == null) ? 0 : getVariables().hashCode()); hashCode = prime * hashCode + ((getWindow() == null) ? 0 : getWindow().hashCode()); hashCode = prime * hashCode + ((getProcessingConfig() == null) ? 0 : getProcessingConfig().hashCode()); return hashCode; } @Override public Metric clone() { try { return (Metric) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } @com.amazonaws.annotation.SdkInternalApi @Override public void marshall(ProtocolMarshaller protocolMarshaller) { com.amazonaws.services.iotsitewise.model.transform.MetricMarshaller.getInstance().marshall(this, protocolMarshaller); } }