/* * 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.timestreamquery.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.protocol.StructuredPojo; import com.amazonaws.protocol.ProtocolMarshaller; /** *

* Datum represents a single data point in a query result. *

* * @see AWS API * Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class Datum implements Serializable, Cloneable, StructuredPojo { /** *

* Indicates if the data point is a scalar value such as integer, string, double, or Boolean. *

*/ private String scalarValue; /** *

* Indicates if the data point is a timeseries data type. *

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

* Indicates if the data point is an array. *

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

* Indicates if the data point is a row. *

*/ private Row rowValue; /** *

* Indicates if the data point is null. *

*/ private Boolean nullValue; /** *

* Indicates if the data point is a scalar value such as integer, string, double, or Boolean. *

* * @param scalarValue * Indicates if the data point is a scalar value such as integer, string, double, or Boolean. */ public void setScalarValue(String scalarValue) { this.scalarValue = scalarValue; } /** *

* Indicates if the data point is a scalar value such as integer, string, double, or Boolean. *

* * @return Indicates if the data point is a scalar value such as integer, string, double, or Boolean. */ public String getScalarValue() { return this.scalarValue; } /** *

* Indicates if the data point is a scalar value such as integer, string, double, or Boolean. *

* * @param scalarValue * Indicates if the data point is a scalar value such as integer, string, double, or Boolean. * @return Returns a reference to this object so that method calls can be chained together. */ public Datum withScalarValue(String scalarValue) { setScalarValue(scalarValue); return this; } /** *

* Indicates if the data point is a timeseries data type. *

* * @return Indicates if the data point is a timeseries data type. */ public java.util.List getTimeSeriesValue() { return timeSeriesValue; } /** *

* Indicates if the data point is a timeseries data type. *

* * @param timeSeriesValue * Indicates if the data point is a timeseries data type. */ public void setTimeSeriesValue(java.util.Collection timeSeriesValue) { if (timeSeriesValue == null) { this.timeSeriesValue = null; return; } this.timeSeriesValue = new java.util.ArrayList(timeSeriesValue); } /** *

* Indicates if the data point is a timeseries data type. *

*

* NOTE: This method appends the values to the existing list (if any). Use * {@link #setTimeSeriesValue(java.util.Collection)} or {@link #withTimeSeriesValue(java.util.Collection)} if you * want to override the existing values. *

* * @param timeSeriesValue * Indicates if the data point is a timeseries data type. * @return Returns a reference to this object so that method calls can be chained together. */ public Datum withTimeSeriesValue(TimeSeriesDataPoint... timeSeriesValue) { if (this.timeSeriesValue == null) { setTimeSeriesValue(new java.util.ArrayList(timeSeriesValue.length)); } for (TimeSeriesDataPoint ele : timeSeriesValue) { this.timeSeriesValue.add(ele); } return this; } /** *

* Indicates if the data point is a timeseries data type. *

* * @param timeSeriesValue * Indicates if the data point is a timeseries data type. * @return Returns a reference to this object so that method calls can be chained together. */ public Datum withTimeSeriesValue(java.util.Collection timeSeriesValue) { setTimeSeriesValue(timeSeriesValue); return this; } /** *

* Indicates if the data point is an array. *

* * @return Indicates if the data point is an array. */ public java.util.List getArrayValue() { return arrayValue; } /** *

* Indicates if the data point is an array. *

* * @param arrayValue * Indicates if the data point is an array. */ public void setArrayValue(java.util.Collection arrayValue) { if (arrayValue == null) { this.arrayValue = null; return; } this.arrayValue = new java.util.ArrayList(arrayValue); } /** *

* Indicates if the data point is an array. *

*

* NOTE: This method appends the values to the existing list (if any). Use * {@link #setArrayValue(java.util.Collection)} or {@link #withArrayValue(java.util.Collection)} if you want to * override the existing values. *

* * @param arrayValue * Indicates if the data point is an array. * @return Returns a reference to this object so that method calls can be chained together. */ public Datum withArrayValue(Datum... arrayValue) { if (this.arrayValue == null) { setArrayValue(new java.util.ArrayList(arrayValue.length)); } for (Datum ele : arrayValue) { this.arrayValue.add(ele); } return this; } /** *

* Indicates if the data point is an array. *

* * @param arrayValue * Indicates if the data point is an array. * @return Returns a reference to this object so that method calls can be chained together. */ public Datum withArrayValue(java.util.Collection arrayValue) { setArrayValue(arrayValue); return this; } /** *

* Indicates if the data point is a row. *

* * @param rowValue * Indicates if the data point is a row. */ public void setRowValue(Row rowValue) { this.rowValue = rowValue; } /** *

* Indicates if the data point is a row. *

* * @return Indicates if the data point is a row. */ public Row getRowValue() { return this.rowValue; } /** *

* Indicates if the data point is a row. *

* * @param rowValue * Indicates if the data point is a row. * @return Returns a reference to this object so that method calls can be chained together. */ public Datum withRowValue(Row rowValue) { setRowValue(rowValue); return this; } /** *

* Indicates if the data point is null. *

* * @param nullValue * Indicates if the data point is null. */ public void setNullValue(Boolean nullValue) { this.nullValue = nullValue; } /** *

* Indicates if the data point is null. *

* * @return Indicates if the data point is null. */ public Boolean getNullValue() { return this.nullValue; } /** *

* Indicates if the data point is null. *

* * @param nullValue * Indicates if the data point is null. * @return Returns a reference to this object so that method calls can be chained together. */ public Datum withNullValue(Boolean nullValue) { setNullValue(nullValue); return this; } /** *

* Indicates if the data point is null. *

* * @return Indicates if the data point is null. */ public Boolean isNullValue() { return this.nullValue; } /** * 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 (getScalarValue() != null) sb.append("ScalarValue: ").append(getScalarValue()).append(","); if (getTimeSeriesValue() != null) sb.append("TimeSeriesValue: ").append(getTimeSeriesValue()).append(","); if (getArrayValue() != null) sb.append("ArrayValue: ").append(getArrayValue()).append(","); if (getRowValue() != null) sb.append("RowValue: ").append(getRowValue()).append(","); if (getNullValue() != null) sb.append("NullValue: ").append(getNullValue()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof Datum == false) return false; Datum other = (Datum) obj; if (other.getScalarValue() == null ^ this.getScalarValue() == null) return false; if (other.getScalarValue() != null && other.getScalarValue().equals(this.getScalarValue()) == false) return false; if (other.getTimeSeriesValue() == null ^ this.getTimeSeriesValue() == null) return false; if (other.getTimeSeriesValue() != null && other.getTimeSeriesValue().equals(this.getTimeSeriesValue()) == false) return false; if (other.getArrayValue() == null ^ this.getArrayValue() == null) return false; if (other.getArrayValue() != null && other.getArrayValue().equals(this.getArrayValue()) == false) return false; if (other.getRowValue() == null ^ this.getRowValue() == null) return false; if (other.getRowValue() != null && other.getRowValue().equals(this.getRowValue()) == false) return false; if (other.getNullValue() == null ^ this.getNullValue() == null) return false; if (other.getNullValue() != null && other.getNullValue().equals(this.getNullValue()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getScalarValue() == null) ? 0 : getScalarValue().hashCode()); hashCode = prime * hashCode + ((getTimeSeriesValue() == null) ? 0 : getTimeSeriesValue().hashCode()); hashCode = prime * hashCode + ((getArrayValue() == null) ? 0 : getArrayValue().hashCode()); hashCode = prime * hashCode + ((getRowValue() == null) ? 0 : getRowValue().hashCode()); hashCode = prime * hashCode + ((getNullValue() == null) ? 0 : getNullValue().hashCode()); return hashCode; } @Override public Datum clone() { try { return (Datum) 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.timestreamquery.model.transform.DatumMarshaller.getInstance().marshall(this, protocolMarshaller); } }