com.amazonaws.services.athena.model.TableMetadata Maven / Gradle / Ivy
Show all versions of aws-java-sdk-athena 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.athena.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* Contains metadata for a table.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class TableMetadata implements Serializable, Cloneable, StructuredPojo {
/**
*
* The name of the table.
*
*/
private String name;
/**
*
* The time that the table was created.
*
*/
private java.util.Date createTime;
/**
*
* The last time the table was accessed.
*
*/
private java.util.Date lastAccessTime;
/**
*
* The type of table. In Athena, only EXTERNAL_TABLE
is supported.
*
*/
private String tableType;
/**
*
* A list of the columns in the table.
*
*/
private java.util.List columns;
/**
*
* A list of the partition keys in the table.
*
*/
private java.util.List partitionKeys;
/**
*
* A set of custom key/value pairs for table properties.
*
*/
private java.util.Map parameters;
/**
*
* The name of the table.
*
*
* @param name
* The name of the table.
*/
public void setName(String name) {
this.name = name;
}
/**
*
* The name of the table.
*
*
* @return The name of the table.
*/
public String getName() {
return this.name;
}
/**
*
* The name of the table.
*
*
* @param name
* The name of the table.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TableMetadata withName(String name) {
setName(name);
return this;
}
/**
*
* The time that the table was created.
*
*
* @param createTime
* The time that the table was created.
*/
public void setCreateTime(java.util.Date createTime) {
this.createTime = createTime;
}
/**
*
* The time that the table was created.
*
*
* @return The time that the table was created.
*/
public java.util.Date getCreateTime() {
return this.createTime;
}
/**
*
* The time that the table was created.
*
*
* @param createTime
* The time that the table was created.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TableMetadata withCreateTime(java.util.Date createTime) {
setCreateTime(createTime);
return this;
}
/**
*
* The last time the table was accessed.
*
*
* @param lastAccessTime
* The last time the table was accessed.
*/
public void setLastAccessTime(java.util.Date lastAccessTime) {
this.lastAccessTime = lastAccessTime;
}
/**
*
* The last time the table was accessed.
*
*
* @return The last time the table was accessed.
*/
public java.util.Date getLastAccessTime() {
return this.lastAccessTime;
}
/**
*
* The last time the table was accessed.
*
*
* @param lastAccessTime
* The last time the table was accessed.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TableMetadata withLastAccessTime(java.util.Date lastAccessTime) {
setLastAccessTime(lastAccessTime);
return this;
}
/**
*
* The type of table. In Athena, only EXTERNAL_TABLE
is supported.
*
*
* @param tableType
* The type of table. In Athena, only EXTERNAL_TABLE
is supported.
*/
public void setTableType(String tableType) {
this.tableType = tableType;
}
/**
*
* The type of table. In Athena, only EXTERNAL_TABLE
is supported.
*
*
* @return The type of table. In Athena, only EXTERNAL_TABLE
is supported.
*/
public String getTableType() {
return this.tableType;
}
/**
*
* The type of table. In Athena, only EXTERNAL_TABLE
is supported.
*
*
* @param tableType
* The type of table. In Athena, only EXTERNAL_TABLE
is supported.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TableMetadata withTableType(String tableType) {
setTableType(tableType);
return this;
}
/**
*
* A list of the columns in the table.
*
*
* @return A list of the columns in the table.
*/
public java.util.List getColumns() {
return columns;
}
/**
*
* A list of the columns in the table.
*
*
* @param columns
* A list of the columns in the table.
*/
public void setColumns(java.util.Collection columns) {
if (columns == null) {
this.columns = null;
return;
}
this.columns = new java.util.ArrayList(columns);
}
/**
*
* A list of the columns in the table.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setColumns(java.util.Collection)} or {@link #withColumns(java.util.Collection)} if you want to override
* the existing values.
*
*
* @param columns
* A list of the columns in the table.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TableMetadata withColumns(Column... columns) {
if (this.columns == null) {
setColumns(new java.util.ArrayList(columns.length));
}
for (Column ele : columns) {
this.columns.add(ele);
}
return this;
}
/**
*
* A list of the columns in the table.
*
*
* @param columns
* A list of the columns in the table.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TableMetadata withColumns(java.util.Collection columns) {
setColumns(columns);
return this;
}
/**
*
* A list of the partition keys in the table.
*
*
* @return A list of the partition keys in the table.
*/
public java.util.List getPartitionKeys() {
return partitionKeys;
}
/**
*
* A list of the partition keys in the table.
*
*
* @param partitionKeys
* A list of the partition keys in the table.
*/
public void setPartitionKeys(java.util.Collection partitionKeys) {
if (partitionKeys == null) {
this.partitionKeys = null;
return;
}
this.partitionKeys = new java.util.ArrayList(partitionKeys);
}
/**
*
* A list of the partition keys in the table.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setPartitionKeys(java.util.Collection)} or {@link #withPartitionKeys(java.util.Collection)} if you want
* to override the existing values.
*
*
* @param partitionKeys
* A list of the partition keys in the table.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TableMetadata withPartitionKeys(Column... partitionKeys) {
if (this.partitionKeys == null) {
setPartitionKeys(new java.util.ArrayList(partitionKeys.length));
}
for (Column ele : partitionKeys) {
this.partitionKeys.add(ele);
}
return this;
}
/**
*
* A list of the partition keys in the table.
*
*
* @param partitionKeys
* A list of the partition keys in the table.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TableMetadata withPartitionKeys(java.util.Collection partitionKeys) {
setPartitionKeys(partitionKeys);
return this;
}
/**
*
* A set of custom key/value pairs for table properties.
*
*
* @return A set of custom key/value pairs for table properties.
*/
public java.util.Map getParameters() {
return parameters;
}
/**
*
* A set of custom key/value pairs for table properties.
*
*
* @param parameters
* A set of custom key/value pairs for table properties.
*/
public void setParameters(java.util.Map parameters) {
this.parameters = parameters;
}
/**
*
* A set of custom key/value pairs for table properties.
*
*
* @param parameters
* A set of custom key/value pairs for table properties.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TableMetadata withParameters(java.util.Map parameters) {
setParameters(parameters);
return this;
}
/**
* Add a single Parameters entry
*
* @see TableMetadata#withParameters
* @returns a reference to this object so that method calls can be chained together.
*/
public TableMetadata addParametersEntry(String key, String value) {
if (null == this.parameters) {
this.parameters = new java.util.HashMap();
}
if (this.parameters.containsKey(key))
throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided.");
this.parameters.put(key, value);
return this;
}
/**
* Removes all the entries added into Parameters.
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TableMetadata clearParametersEntries() {
this.parameters = null;
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 (getName() != null)
sb.append("Name: ").append(getName()).append(",");
if (getCreateTime() != null)
sb.append("CreateTime: ").append(getCreateTime()).append(",");
if (getLastAccessTime() != null)
sb.append("LastAccessTime: ").append(getLastAccessTime()).append(",");
if (getTableType() != null)
sb.append("TableType: ").append(getTableType()).append(",");
if (getColumns() != null)
sb.append("Columns: ").append(getColumns()).append(",");
if (getPartitionKeys() != null)
sb.append("PartitionKeys: ").append(getPartitionKeys()).append(",");
if (getParameters() != null)
sb.append("Parameters: ").append(getParameters());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof TableMetadata == false)
return false;
TableMetadata other = (TableMetadata) obj;
if (other.getName() == null ^ this.getName() == null)
return false;
if (other.getName() != null && other.getName().equals(this.getName()) == false)
return false;
if (other.getCreateTime() == null ^ this.getCreateTime() == null)
return false;
if (other.getCreateTime() != null && other.getCreateTime().equals(this.getCreateTime()) == false)
return false;
if (other.getLastAccessTime() == null ^ this.getLastAccessTime() == null)
return false;
if (other.getLastAccessTime() != null && other.getLastAccessTime().equals(this.getLastAccessTime()) == false)
return false;
if (other.getTableType() == null ^ this.getTableType() == null)
return false;
if (other.getTableType() != null && other.getTableType().equals(this.getTableType()) == false)
return false;
if (other.getColumns() == null ^ this.getColumns() == null)
return false;
if (other.getColumns() != null && other.getColumns().equals(this.getColumns()) == false)
return false;
if (other.getPartitionKeys() == null ^ this.getPartitionKeys() == null)
return false;
if (other.getPartitionKeys() != null && other.getPartitionKeys().equals(this.getPartitionKeys()) == false)
return false;
if (other.getParameters() == null ^ this.getParameters() == null)
return false;
if (other.getParameters() != null && other.getParameters().equals(this.getParameters()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getName() == null) ? 0 : getName().hashCode());
hashCode = prime * hashCode + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
hashCode = prime * hashCode + ((getLastAccessTime() == null) ? 0 : getLastAccessTime().hashCode());
hashCode = prime * hashCode + ((getTableType() == null) ? 0 : getTableType().hashCode());
hashCode = prime * hashCode + ((getColumns() == null) ? 0 : getColumns().hashCode());
hashCode = prime * hashCode + ((getPartitionKeys() == null) ? 0 : getPartitionKeys().hashCode());
hashCode = prime * hashCode + ((getParameters() == null) ? 0 : getParameters().hashCode());
return hashCode;
}
@Override
public TableMetadata clone() {
try {
return (TableMetadata) 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.athena.model.transform.TableMetadataMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}