com.amazonaws.services.cleanrooms.model.AggregateColumn Maven / Gradle / Ivy
Show all versions of aws-java-sdk-cleanrooms Show documentation
/*
* Copyright 2019-2024 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.cleanrooms.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* Column in configured table that can be used in aggregate function in query.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class AggregateColumn implements Serializable, Cloneable, StructuredPojo {
/**
*
* Column names in configured table of aggregate columns.
*
*/
private java.util.List columnNames;
/**
*
* Aggregation function that can be applied to aggregate column in query.
*
*/
private String function;
/**
*
* Column names in configured table of aggregate columns.
*
*
* @return Column names in configured table of aggregate columns.
*/
public java.util.List getColumnNames() {
return columnNames;
}
/**
*
* Column names in configured table of aggregate columns.
*
*
* @param columnNames
* Column names in configured table of aggregate columns.
*/
public void setColumnNames(java.util.Collection columnNames) {
if (columnNames == null) {
this.columnNames = null;
return;
}
this.columnNames = new java.util.ArrayList(columnNames);
}
/**
*
* Column names in configured table of aggregate columns.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setColumnNames(java.util.Collection)} or {@link #withColumnNames(java.util.Collection)} if you want to
* override the existing values.
*
*
* @param columnNames
* Column names in configured table of aggregate columns.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public AggregateColumn withColumnNames(String... columnNames) {
if (this.columnNames == null) {
setColumnNames(new java.util.ArrayList(columnNames.length));
}
for (String ele : columnNames) {
this.columnNames.add(ele);
}
return this;
}
/**
*
* Column names in configured table of aggregate columns.
*
*
* @param columnNames
* Column names in configured table of aggregate columns.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public AggregateColumn withColumnNames(java.util.Collection columnNames) {
setColumnNames(columnNames);
return this;
}
/**
*
* Aggregation function that can be applied to aggregate column in query.
*
*
* @param function
* Aggregation function that can be applied to aggregate column in query.
* @see AggregateFunctionName
*/
public void setFunction(String function) {
this.function = function;
}
/**
*
* Aggregation function that can be applied to aggregate column in query.
*
*
* @return Aggregation function that can be applied to aggregate column in query.
* @see AggregateFunctionName
*/
public String getFunction() {
return this.function;
}
/**
*
* Aggregation function that can be applied to aggregate column in query.
*
*
* @param function
* Aggregation function that can be applied to aggregate column in query.
* @return Returns a reference to this object so that method calls can be chained together.
* @see AggregateFunctionName
*/
public AggregateColumn withFunction(String function) {
setFunction(function);
return this;
}
/**
*
* Aggregation function that can be applied to aggregate column in query.
*
*
* @param function
* Aggregation function that can be applied to aggregate column in query.
* @return Returns a reference to this object so that method calls can be chained together.
* @see AggregateFunctionName
*/
public AggregateColumn withFunction(AggregateFunctionName function) {
this.function = function.toString();
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 (getColumnNames() != null)
sb.append("ColumnNames: ").append(getColumnNames()).append(",");
if (getFunction() != null)
sb.append("Function: ").append(getFunction());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof AggregateColumn == false)
return false;
AggregateColumn other = (AggregateColumn) obj;
if (other.getColumnNames() == null ^ this.getColumnNames() == null)
return false;
if (other.getColumnNames() != null && other.getColumnNames().equals(this.getColumnNames()) == false)
return false;
if (other.getFunction() == null ^ this.getFunction() == null)
return false;
if (other.getFunction() != null && other.getFunction().equals(this.getFunction()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getColumnNames() == null) ? 0 : getColumnNames().hashCode());
hashCode = prime * hashCode + ((getFunction() == null) ? 0 : getFunction().hashCode());
return hashCode;
}
@Override
public AggregateColumn clone() {
try {
return (AggregateColumn) 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.cleanrooms.model.transform.AggregateColumnMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}