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

* Represents a slice of table data. *

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

* The values of the partition. *

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

* The name of the catalog database in which to create the partition. *

*/ private String databaseName; /** *

* The name of the database table in which to create the partition. *

*/ private String tableName; /** *

* The time at which the partition was created. *

*/ private java.util.Date creationTime; /** *

* The last time at which the partition was accessed. *

*/ private java.util.Date lastAccessTime; /** *

* Provides information about the physical location where the partition is stored. *

*/ private StorageDescriptor storageDescriptor; /** *

* These key-value pairs define partition parameters. *

*/ private java.util.Map parameters; /** *

* The last time at which column statistics were computed for this partition. *

*/ private java.util.Date lastAnalyzedTime; /** *

* The ID of the Data Catalog in which the partition resides. *

*/ private String catalogId; /** *

* The values of the partition. *

* * @return The values of the partition. */ public java.util.List getValues() { return values; } /** *

* The values of the partition. *

* * @param values * The values of the partition. */ public void setValues(java.util.Collection values) { if (values == null) { this.values = null; return; } this.values = new java.util.ArrayList(values); } /** *

* The values of the partition. *

*

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

* * @param values * The values of the partition. * @return Returns a reference to this object so that method calls can be chained together. */ public Partition withValues(String... values) { if (this.values == null) { setValues(new java.util.ArrayList(values.length)); } for (String ele : values) { this.values.add(ele); } return this; } /** *

* The values of the partition. *

* * @param values * The values of the partition. * @return Returns a reference to this object so that method calls can be chained together. */ public Partition withValues(java.util.Collection values) { setValues(values); return this; } /** *

* The name of the catalog database in which to create the partition. *

* * @param databaseName * The name of the catalog database in which to create the partition. */ public void setDatabaseName(String databaseName) { this.databaseName = databaseName; } /** *

* The name of the catalog database in which to create the partition. *

* * @return The name of the catalog database in which to create the partition. */ public String getDatabaseName() { return this.databaseName; } /** *

* The name of the catalog database in which to create the partition. *

* * @param databaseName * The name of the catalog database in which to create the partition. * @return Returns a reference to this object so that method calls can be chained together. */ public Partition withDatabaseName(String databaseName) { setDatabaseName(databaseName); return this; } /** *

* The name of the database table in which to create the partition. *

* * @param tableName * The name of the database table in which to create the partition. */ public void setTableName(String tableName) { this.tableName = tableName; } /** *

* The name of the database table in which to create the partition. *

* * @return The name of the database table in which to create the partition. */ public String getTableName() { return this.tableName; } /** *

* The name of the database table in which to create the partition. *

* * @param tableName * The name of the database table in which to create the partition. * @return Returns a reference to this object so that method calls can be chained together. */ public Partition withTableName(String tableName) { setTableName(tableName); return this; } /** *

* The time at which the partition was created. *

* * @param creationTime * The time at which the partition was created. */ public void setCreationTime(java.util.Date creationTime) { this.creationTime = creationTime; } /** *

* The time at which the partition was created. *

* * @return The time at which the partition was created. */ public java.util.Date getCreationTime() { return this.creationTime; } /** *

* The time at which the partition was created. *

* * @param creationTime * The time at which the partition was created. * @return Returns a reference to this object so that method calls can be chained together. */ public Partition withCreationTime(java.util.Date creationTime) { setCreationTime(creationTime); return this; } /** *

* The last time at which the partition was accessed. *

* * @param lastAccessTime * The last time at which the partition was accessed. */ public void setLastAccessTime(java.util.Date lastAccessTime) { this.lastAccessTime = lastAccessTime; } /** *

* The last time at which the partition was accessed. *

* * @return The last time at which the partition was accessed. */ public java.util.Date getLastAccessTime() { return this.lastAccessTime; } /** *

* The last time at which the partition was accessed. *

* * @param lastAccessTime * The last time at which the partition was accessed. * @return Returns a reference to this object so that method calls can be chained together. */ public Partition withLastAccessTime(java.util.Date lastAccessTime) { setLastAccessTime(lastAccessTime); return this; } /** *

* Provides information about the physical location where the partition is stored. *

* * @param storageDescriptor * Provides information about the physical location where the partition is stored. */ public void setStorageDescriptor(StorageDescriptor storageDescriptor) { this.storageDescriptor = storageDescriptor; } /** *

* Provides information about the physical location where the partition is stored. *

* * @return Provides information about the physical location where the partition is stored. */ public StorageDescriptor getStorageDescriptor() { return this.storageDescriptor; } /** *

* Provides information about the physical location where the partition is stored. *

* * @param storageDescriptor * Provides information about the physical location where the partition is stored. * @return Returns a reference to this object so that method calls can be chained together. */ public Partition withStorageDescriptor(StorageDescriptor storageDescriptor) { setStorageDescriptor(storageDescriptor); return this; } /** *

* These key-value pairs define partition parameters. *

* * @return These key-value pairs define partition parameters. */ public java.util.Map getParameters() { return parameters; } /** *

* These key-value pairs define partition parameters. *

* * @param parameters * These key-value pairs define partition parameters. */ public void setParameters(java.util.Map parameters) { this.parameters = parameters; } /** *

* These key-value pairs define partition parameters. *

* * @param parameters * These key-value pairs define partition parameters. * @return Returns a reference to this object so that method calls can be chained together. */ public Partition withParameters(java.util.Map parameters) { setParameters(parameters); return this; } /** * Add a single Parameters entry * * @see Partition#withParameters * @returns a reference to this object so that method calls can be chained together. */ public Partition 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 Partition clearParametersEntries() { this.parameters = null; return this; } /** *

* The last time at which column statistics were computed for this partition. *

* * @param lastAnalyzedTime * The last time at which column statistics were computed for this partition. */ public void setLastAnalyzedTime(java.util.Date lastAnalyzedTime) { this.lastAnalyzedTime = lastAnalyzedTime; } /** *

* The last time at which column statistics were computed for this partition. *

* * @return The last time at which column statistics were computed for this partition. */ public java.util.Date getLastAnalyzedTime() { return this.lastAnalyzedTime; } /** *

* The last time at which column statistics were computed for this partition. *

* * @param lastAnalyzedTime * The last time at which column statistics were computed for this partition. * @return Returns a reference to this object so that method calls can be chained together. */ public Partition withLastAnalyzedTime(java.util.Date lastAnalyzedTime) { setLastAnalyzedTime(lastAnalyzedTime); return this; } /** *

* The ID of the Data Catalog in which the partition resides. *

* * @param catalogId * The ID of the Data Catalog in which the partition resides. */ public void setCatalogId(String catalogId) { this.catalogId = catalogId; } /** *

* The ID of the Data Catalog in which the partition resides. *

* * @return The ID of the Data Catalog in which the partition resides. */ public String getCatalogId() { return this.catalogId; } /** *

* The ID of the Data Catalog in which the partition resides. *

* * @param catalogId * The ID of the Data Catalog in which the partition resides. * @return Returns a reference to this object so that method calls can be chained together. */ public Partition withCatalogId(String catalogId) { setCatalogId(catalogId); 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 (getValues() != null) sb.append("Values: ").append(getValues()).append(","); if (getDatabaseName() != null) sb.append("DatabaseName: ").append(getDatabaseName()).append(","); if (getTableName() != null) sb.append("TableName: ").append(getTableName()).append(","); if (getCreationTime() != null) sb.append("CreationTime: ").append(getCreationTime()).append(","); if (getLastAccessTime() != null) sb.append("LastAccessTime: ").append(getLastAccessTime()).append(","); if (getStorageDescriptor() != null) sb.append("StorageDescriptor: ").append(getStorageDescriptor()).append(","); if (getParameters() != null) sb.append("Parameters: ").append(getParameters()).append(","); if (getLastAnalyzedTime() != null) sb.append("LastAnalyzedTime: ").append(getLastAnalyzedTime()).append(","); if (getCatalogId() != null) sb.append("CatalogId: ").append(getCatalogId()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof Partition == false) return false; Partition other = (Partition) obj; if (other.getValues() == null ^ this.getValues() == null) return false; if (other.getValues() != null && other.getValues().equals(this.getValues()) == false) return false; if (other.getDatabaseName() == null ^ this.getDatabaseName() == null) return false; if (other.getDatabaseName() != null && other.getDatabaseName().equals(this.getDatabaseName()) == false) return false; if (other.getTableName() == null ^ this.getTableName() == null) return false; if (other.getTableName() != null && other.getTableName().equals(this.getTableName()) == false) return false; if (other.getCreationTime() == null ^ this.getCreationTime() == null) return false; if (other.getCreationTime() != null && other.getCreationTime().equals(this.getCreationTime()) == 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.getStorageDescriptor() == null ^ this.getStorageDescriptor() == null) return false; if (other.getStorageDescriptor() != null && other.getStorageDescriptor().equals(this.getStorageDescriptor()) == false) return false; if (other.getParameters() == null ^ this.getParameters() == null) return false; if (other.getParameters() != null && other.getParameters().equals(this.getParameters()) == false) return false; if (other.getLastAnalyzedTime() == null ^ this.getLastAnalyzedTime() == null) return false; if (other.getLastAnalyzedTime() != null && other.getLastAnalyzedTime().equals(this.getLastAnalyzedTime()) == false) return false; if (other.getCatalogId() == null ^ this.getCatalogId() == null) return false; if (other.getCatalogId() != null && other.getCatalogId().equals(this.getCatalogId()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getValues() == null) ? 0 : getValues().hashCode()); hashCode = prime * hashCode + ((getDatabaseName() == null) ? 0 : getDatabaseName().hashCode()); hashCode = prime * hashCode + ((getTableName() == null) ? 0 : getTableName().hashCode()); hashCode = prime * hashCode + ((getCreationTime() == null) ? 0 : getCreationTime().hashCode()); hashCode = prime * hashCode + ((getLastAccessTime() == null) ? 0 : getLastAccessTime().hashCode()); hashCode = prime * hashCode + ((getStorageDescriptor() == null) ? 0 : getStorageDescriptor().hashCode()); hashCode = prime * hashCode + ((getParameters() == null) ? 0 : getParameters().hashCode()); hashCode = prime * hashCode + ((getLastAnalyzedTime() == null) ? 0 : getLastAnalyzedTime().hashCode()); hashCode = prime * hashCode + ((getCatalogId() == null) ? 0 : getCatalogId().hashCode()); return hashCode; } @Override public Partition clone() { try { return (Partition) 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.glue.model.transform.PartitionMarshaller.getInstance().marshall(this, protocolMarshaller); } }