/* * Copyright 2010-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.iot.model; import java.io.Serializable; /** *

* The value to be compared with the metric. *

*/ public class MetricValue implements Serializable { /** *

* If the comparisonOperator calls for a numeric value, use * this to specify that numeric value to be compared with the * metric. *

*

* Constraints:
* Range: 0 -
*/ private Long count; /** *

* If the comparisonOperator calls for a set of CIDRs, use this * to specify that set to be compared with the metric. *

*/ private java.util.List cidrs; /** *

* If the comparisonOperator calls for a set of ports, use this * to specify that set to be compared with the metric. *

*/ private java.util.List ports; /** *

* The numeral value of a metric. *

*/ private Double number; /** *

* The numeral values of a metric. *

*/ private java.util.List numbers; /** *

* The string values of a metric. *

*/ private java.util.List strings; /** *

* If the comparisonOperator calls for a numeric value, use * this to specify that numeric value to be compared with the * metric. *

*

* Constraints:
* Range: 0 -
* * @return

* If the comparisonOperator calls for a numeric value, * use this to specify that numeric value to be compared with the * metric. *

*/ public Long getCount() { return count; } /** *

* If the comparisonOperator calls for a numeric value, use * this to specify that numeric value to be compared with the * metric. *

*

* Constraints:
* Range: 0 -
* * @param count

* If the comparisonOperator calls for a numeric * value, use this to specify that numeric value to be compared * with the metric. *

*/ public void setCount(Long count) { this.count = count; } /** *

* If the comparisonOperator calls for a numeric value, use * this to specify that numeric value to be compared with the * metric. *

*

* Returns a reference to this object so that method calls can be chained * together. *

* Constraints:
* Range: 0 -
* * @param count

* If the comparisonOperator calls for a numeric * value, use this to specify that numeric value to be compared * with the metric. *

* @return A reference to this updated object so that method calls can be * chained together. */ public MetricValue withCount(Long count) { this.count = count; return this; } /** *

* If the comparisonOperator calls for a set of CIDRs, use this * to specify that set to be compared with the metric. *

* * @return

* If the comparisonOperator calls for a set of CIDRs, * use this to specify that set to be compared with the * metric. *

*/ public java.util.List getCidrs() { return cidrs; } /** *

* If the comparisonOperator calls for a set of CIDRs, use this * to specify that set to be compared with the metric. *

* * @param cidrs

* If the comparisonOperator calls for a set of * CIDRs, use this to specify that set to be compared with the * metric. *

*/ public void setCidrs(java.util.Collection cidrs) { if (cidrs == null) { this.cidrs = null; return; } this.cidrs = new java.util.ArrayList(cidrs); } /** *

* If the comparisonOperator calls for a set of CIDRs, use this * to specify that set to be compared with the metric. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param cidrs

* If the comparisonOperator calls for a set of * CIDRs, use this to specify that set to be compared with the * metric. *

* @return A reference to this updated object so that method calls can be * chained together. */ public MetricValue withCidrs(String... cidrs) { if (getCidrs() == null) { this.cidrs = new java.util.ArrayList(cidrs.length); } for (String value : cidrs) { this.cidrs.add(value); } return this; } /** *

* If the comparisonOperator calls for a set of CIDRs, use this * to specify that set to be compared with the metric. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param cidrs

* If the comparisonOperator calls for a set of * CIDRs, use this to specify that set to be compared with the * metric. *

* @return A reference to this updated object so that method calls can be * chained together. */ public MetricValue withCidrs(java.util.Collection cidrs) { setCidrs(cidrs); return this; } /** *

* If the comparisonOperator calls for a set of ports, use this * to specify that set to be compared with the metric. *

* * @return

* If the comparisonOperator calls for a set of ports, * use this to specify that set to be compared with the * metric. *

*/ public java.util.List getPorts() { return ports; } /** *

* If the comparisonOperator calls for a set of ports, use this * to specify that set to be compared with the metric. *

* * @param ports

* If the comparisonOperator calls for a set of * ports, use this to specify that set to be compared with the * metric. *

*/ public void setPorts(java.util.Collection ports) { if (ports == null) { this.ports = null; return; } this.ports = new java.util.ArrayList(ports); } /** *

* If the comparisonOperator calls for a set of ports, use this * to specify that set to be compared with the metric. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param ports

* If the comparisonOperator calls for a set of * ports, use this to specify that set to be compared with the * metric. *

* @return A reference to this updated object so that method calls can be * chained together. */ public MetricValue withPorts(Integer... ports) { if (getPorts() == null) { this.ports = new java.util.ArrayList(ports.length); } for (Integer value : ports) { this.ports.add(value); } return this; } /** *

* If the comparisonOperator calls for a set of ports, use this * to specify that set to be compared with the metric. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param ports

* If the comparisonOperator calls for a set of * ports, use this to specify that set to be compared with the * metric. *

* @return A reference to this updated object so that method calls can be * chained together. */ public MetricValue withPorts(java.util.Collection ports) { setPorts(ports); return this; } /** *

* The numeral value of a metric. *

* * @return

* The numeral value of a metric. *

*/ public Double getNumber() { return number; } /** *

* The numeral value of a metric. *

* * @param number

* The numeral value of a metric. *

*/ public void setNumber(Double number) { this.number = number; } /** *

* The numeral value of a metric. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param number

* The numeral value of a metric. *

* @return A reference to this updated object so that method calls can be * chained together. */ public MetricValue withNumber(Double number) { this.number = number; return this; } /** *

* The numeral values of a metric. *

* * @return

* The numeral values of a metric. *

*/ public java.util.List getNumbers() { return numbers; } /** *

* The numeral values of a metric. *

* * @param numbers

* The numeral values of a metric. *

*/ public void setNumbers(java.util.Collection numbers) { if (numbers == null) { this.numbers = null; return; } this.numbers = new java.util.ArrayList(numbers); } /** *

* The numeral values of a metric. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param numbers

* The numeral values of a metric. *

* @return A reference to this updated object so that method calls can be * chained together. */ public MetricValue withNumbers(Double... numbers) { if (getNumbers() == null) { this.numbers = new java.util.ArrayList(numbers.length); } for (Double value : numbers) { this.numbers.add(value); } return this; } /** *

* The numeral values of a metric. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param numbers

* The numeral values of a metric. *

* @return A reference to this updated object so that method calls can be * chained together. */ public MetricValue withNumbers(java.util.Collection numbers) { setNumbers(numbers); return this; } /** *

* The string values of a metric. *

* * @return

* The string values of a metric. *

*/ public java.util.List getStrings() { return strings; } /** *

* The string values of a metric. *

* * @param strings

* The string values of a metric. *

*/ public void setStrings(java.util.Collection strings) { if (strings == null) { this.strings = null; return; } this.strings = new java.util.ArrayList(strings); } /** *

* The string values of a metric. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param strings

* The string values of a metric. *

* @return A reference to this updated object so that method calls can be * chained together. */ public MetricValue withStrings(String... strings) { if (getStrings() == null) { this.strings = new java.util.ArrayList(strings.length); } for (String value : strings) { this.strings.add(value); } return this; } /** *

* The string values of a metric. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param strings

* The string values of a metric. *

* @return A reference to this updated object so that method calls can be * chained together. */ public MetricValue withStrings(java.util.Collection strings) { setStrings(strings); return this; } /** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getCount() != null) sb.append("count: " + getCount() + ","); if (getCidrs() != null) sb.append("cidrs: " + getCidrs() + ","); if (getPorts() != null) sb.append("ports: " + getPorts() + ","); if (getNumber() != null) sb.append("number: " + getNumber() + ","); if (getNumbers() != null) sb.append("numbers: " + getNumbers() + ","); if (getStrings() != null) sb.append("strings: " + getStrings()); sb.append("}"); return sb.toString(); } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getCount() == null) ? 0 : getCount().hashCode()); hashCode = prime * hashCode + ((getCidrs() == null) ? 0 : getCidrs().hashCode()); hashCode = prime * hashCode + ((getPorts() == null) ? 0 : getPorts().hashCode()); hashCode = prime * hashCode + ((getNumber() == null) ? 0 : getNumber().hashCode()); hashCode = prime * hashCode + ((getNumbers() == null) ? 0 : getNumbers().hashCode()); hashCode = prime * hashCode + ((getStrings() == null) ? 0 : getStrings().hashCode()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof MetricValue == false) return false; MetricValue other = (MetricValue) obj; if (other.getCount() == null ^ this.getCount() == null) return false; if (other.getCount() != null && other.getCount().equals(this.getCount()) == false) return false; if (other.getCidrs() == null ^ this.getCidrs() == null) return false; if (other.getCidrs() != null && other.getCidrs().equals(this.getCidrs()) == false) return false; if (other.getPorts() == null ^ this.getPorts() == null) return false; if (other.getPorts() != null && other.getPorts().equals(this.getPorts()) == false) return false; if (other.getNumber() == null ^ this.getNumber() == null) return false; if (other.getNumber() != null && other.getNumber().equals(this.getNumber()) == false) return false; if (other.getNumbers() == null ^ this.getNumbers() == null) return false; if (other.getNumbers() != null && other.getNumbers().equals(this.getNumbers()) == false) return false; if (other.getStrings() == null ^ this.getStrings() == null) return false; if (other.getStrings() != null && other.getStrings().equals(this.getStrings()) == false) return false; return true; } }