/* * 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; /** *

* Additional connection options for the connector. *

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

* Extra condition clause to filter data from source. For example: *

*

* BillingCity='Mountain View' *

*

* When using a query instead of a table name, you should validate that the query works with the specified * filterPredicate. *

*/ private String filterPredicate; /** *

* The name of an integer column that is used for partitioning. This option works only when it's included with * lowerBound, upperBound, and numPartitions. This option works the same way * as in the Spark SQL JDBC reader. *

*/ private String partitionColumn; /** *

* The minimum value of partitionColumn that is used to decide partition stride. *

*/ private Long lowerBound; /** *

* The maximum value of partitionColumn that is used to decide partition stride. *

*/ private Long upperBound; /** *

* The number of partitions. This value, along with lowerBound (inclusive) and upperBound * (exclusive), form partition strides for generated WHERE clause expressions that are used to split * the partitionColumn. *

*/ private Long numPartitions; /** *

* The name of the job bookmark keys on which to sort. *

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

* Specifies an ascending or descending sort order. *

*/ private String jobBookmarkKeysSortOrder; /** *

* Custom data type mapping that builds a mapping from a JDBC data type to an Glue data type. For example, the * option "dataTypeMapping":{"FLOAT":"STRING"} maps data fields of JDBC type FLOAT into * the Java String type by calling the ResultSet.getString() method of the driver, and * uses it to build the Glue record. The ResultSet object is implemented by each driver, so the * behavior is specific to the driver you use. Refer to the documentation for your JDBC driver to understand how the * driver performs the conversions. *

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

* Extra condition clause to filter data from source. For example: *

*

* BillingCity='Mountain View' *

*

* When using a query instead of a table name, you should validate that the query works with the specified * filterPredicate. *

* * @param filterPredicate * Extra condition clause to filter data from source. For example:

*

* BillingCity='Mountain View' *

*

* When using a query instead of a table name, you should validate that the query works with the specified * filterPredicate. */ public void setFilterPredicate(String filterPredicate) { this.filterPredicate = filterPredicate; } /** *

* Extra condition clause to filter data from source. For example: *

*

* BillingCity='Mountain View' *

*

* When using a query instead of a table name, you should validate that the query works with the specified * filterPredicate. *

* * @return Extra condition clause to filter data from source. For example:

*

* BillingCity='Mountain View' *

*

* When using a query instead of a table name, you should validate that the query works with the specified * filterPredicate. */ public String getFilterPredicate() { return this.filterPredicate; } /** *

* Extra condition clause to filter data from source. For example: *

*

* BillingCity='Mountain View' *

*

* When using a query instead of a table name, you should validate that the query works with the specified * filterPredicate. *

* * @param filterPredicate * Extra condition clause to filter data from source. For example:

*

* BillingCity='Mountain View' *

*

* When using a query instead of a table name, you should validate that the query works with the specified * filterPredicate. * @return Returns a reference to this object so that method calls can be chained together. */ public JDBCConnectorOptions withFilterPredicate(String filterPredicate) { setFilterPredicate(filterPredicate); return this; } /** *

* The name of an integer column that is used for partitioning. This option works only when it's included with * lowerBound, upperBound, and numPartitions. This option works the same way * as in the Spark SQL JDBC reader. *

* * @param partitionColumn * The name of an integer column that is used for partitioning. This option works only when it's included * with lowerBound, upperBound, and numPartitions. This option works * the same way as in the Spark SQL JDBC reader. */ public void setPartitionColumn(String partitionColumn) { this.partitionColumn = partitionColumn; } /** *

* The name of an integer column that is used for partitioning. This option works only when it's included with * lowerBound, upperBound, and numPartitions. This option works the same way * as in the Spark SQL JDBC reader. *

* * @return The name of an integer column that is used for partitioning. This option works only when it's included * with lowerBound, upperBound, and numPartitions. This option works * the same way as in the Spark SQL JDBC reader. */ public String getPartitionColumn() { return this.partitionColumn; } /** *

* The name of an integer column that is used for partitioning. This option works only when it's included with * lowerBound, upperBound, and numPartitions. This option works the same way * as in the Spark SQL JDBC reader. *

* * @param partitionColumn * The name of an integer column that is used for partitioning. This option works only when it's included * with lowerBound, upperBound, and numPartitions. This option works * the same way as in the Spark SQL JDBC reader. * @return Returns a reference to this object so that method calls can be chained together. */ public JDBCConnectorOptions withPartitionColumn(String partitionColumn) { setPartitionColumn(partitionColumn); return this; } /** *

* The minimum value of partitionColumn that is used to decide partition stride. *

* * @param lowerBound * The minimum value of partitionColumn that is used to decide partition stride. */ public void setLowerBound(Long lowerBound) { this.lowerBound = lowerBound; } /** *

* The minimum value of partitionColumn that is used to decide partition stride. *

* * @return The minimum value of partitionColumn that is used to decide partition stride. */ public Long getLowerBound() { return this.lowerBound; } /** *

* The minimum value of partitionColumn that is used to decide partition stride. *

* * @param lowerBound * The minimum value of partitionColumn that is used to decide partition stride. * @return Returns a reference to this object so that method calls can be chained together. */ public JDBCConnectorOptions withLowerBound(Long lowerBound) { setLowerBound(lowerBound); return this; } /** *

* The maximum value of partitionColumn that is used to decide partition stride. *

* * @param upperBound * The maximum value of partitionColumn that is used to decide partition stride. */ public void setUpperBound(Long upperBound) { this.upperBound = upperBound; } /** *

* The maximum value of partitionColumn that is used to decide partition stride. *

* * @return The maximum value of partitionColumn that is used to decide partition stride. */ public Long getUpperBound() { return this.upperBound; } /** *

* The maximum value of partitionColumn that is used to decide partition stride. *

* * @param upperBound * The maximum value of partitionColumn that is used to decide partition stride. * @return Returns a reference to this object so that method calls can be chained together. */ public JDBCConnectorOptions withUpperBound(Long upperBound) { setUpperBound(upperBound); return this; } /** *

* The number of partitions. This value, along with lowerBound (inclusive) and upperBound * (exclusive), form partition strides for generated WHERE clause expressions that are used to split * the partitionColumn. *

* * @param numPartitions * The number of partitions. This value, along with lowerBound (inclusive) and * upperBound (exclusive), form partition strides for generated WHERE clause * expressions that are used to split the partitionColumn. */ public void setNumPartitions(Long numPartitions) { this.numPartitions = numPartitions; } /** *

* The number of partitions. This value, along with lowerBound (inclusive) and upperBound * (exclusive), form partition strides for generated WHERE clause expressions that are used to split * the partitionColumn. *

* * @return The number of partitions. This value, along with lowerBound (inclusive) and * upperBound (exclusive), form partition strides for generated WHERE clause * expressions that are used to split the partitionColumn. */ public Long getNumPartitions() { return this.numPartitions; } /** *

* The number of partitions. This value, along with lowerBound (inclusive) and upperBound * (exclusive), form partition strides for generated WHERE clause expressions that are used to split * the partitionColumn. *

* * @param numPartitions * The number of partitions. This value, along with lowerBound (inclusive) and * upperBound (exclusive), form partition strides for generated WHERE clause * expressions that are used to split the partitionColumn. * @return Returns a reference to this object so that method calls can be chained together. */ public JDBCConnectorOptions withNumPartitions(Long numPartitions) { setNumPartitions(numPartitions); return this; } /** *

* The name of the job bookmark keys on which to sort. *

* * @return The name of the job bookmark keys on which to sort. */ public java.util.List getJobBookmarkKeys() { return jobBookmarkKeys; } /** *

* The name of the job bookmark keys on which to sort. *

* * @param jobBookmarkKeys * The name of the job bookmark keys on which to sort. */ public void setJobBookmarkKeys(java.util.Collection jobBookmarkKeys) { if (jobBookmarkKeys == null) { this.jobBookmarkKeys = null; return; } this.jobBookmarkKeys = new java.util.ArrayList(jobBookmarkKeys); } /** *

* The name of the job bookmark keys on which to sort. *

*

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

* * @param jobBookmarkKeys * The name of the job bookmark keys on which to sort. * @return Returns a reference to this object so that method calls can be chained together. */ public JDBCConnectorOptions withJobBookmarkKeys(String... jobBookmarkKeys) { if (this.jobBookmarkKeys == null) { setJobBookmarkKeys(new java.util.ArrayList(jobBookmarkKeys.length)); } for (String ele : jobBookmarkKeys) { this.jobBookmarkKeys.add(ele); } return this; } /** *

* The name of the job bookmark keys on which to sort. *

* * @param jobBookmarkKeys * The name of the job bookmark keys on which to sort. * @return Returns a reference to this object so that method calls can be chained together. */ public JDBCConnectorOptions withJobBookmarkKeys(java.util.Collection jobBookmarkKeys) { setJobBookmarkKeys(jobBookmarkKeys); return this; } /** *

* Specifies an ascending or descending sort order. *

* * @param jobBookmarkKeysSortOrder * Specifies an ascending or descending sort order. */ public void setJobBookmarkKeysSortOrder(String jobBookmarkKeysSortOrder) { this.jobBookmarkKeysSortOrder = jobBookmarkKeysSortOrder; } /** *

* Specifies an ascending or descending sort order. *

* * @return Specifies an ascending or descending sort order. */ public String getJobBookmarkKeysSortOrder() { return this.jobBookmarkKeysSortOrder; } /** *

* Specifies an ascending or descending sort order. *

* * @param jobBookmarkKeysSortOrder * Specifies an ascending or descending sort order. * @return Returns a reference to this object so that method calls can be chained together. */ public JDBCConnectorOptions withJobBookmarkKeysSortOrder(String jobBookmarkKeysSortOrder) { setJobBookmarkKeysSortOrder(jobBookmarkKeysSortOrder); return this; } /** *

* Custom data type mapping that builds a mapping from a JDBC data type to an Glue data type. For example, the * option "dataTypeMapping":{"FLOAT":"STRING"} maps data fields of JDBC type FLOAT into * the Java String type by calling the ResultSet.getString() method of the driver, and * uses it to build the Glue record. The ResultSet object is implemented by each driver, so the * behavior is specific to the driver you use. Refer to the documentation for your JDBC driver to understand how the * driver performs the conversions. *

* * @return Custom data type mapping that builds a mapping from a JDBC data type to an Glue data type. For example, * the option "dataTypeMapping":{"FLOAT":"STRING"} maps data fields of JDBC type * FLOAT into the Java String type by calling the * ResultSet.getString() method of the driver, and uses it to build the Glue record. The * ResultSet object is implemented by each driver, so the behavior is specific to the driver * you use. Refer to the documentation for your JDBC driver to understand how the driver performs the * conversions. */ public java.util.Map getDataTypeMapping() { return dataTypeMapping; } /** *

* Custom data type mapping that builds a mapping from a JDBC data type to an Glue data type. For example, the * option "dataTypeMapping":{"FLOAT":"STRING"} maps data fields of JDBC type FLOAT into * the Java String type by calling the ResultSet.getString() method of the driver, and * uses it to build the Glue record. The ResultSet object is implemented by each driver, so the * behavior is specific to the driver you use. Refer to the documentation for your JDBC driver to understand how the * driver performs the conversions. *

* * @param dataTypeMapping * Custom data type mapping that builds a mapping from a JDBC data type to an Glue data type. For example, * the option "dataTypeMapping":{"FLOAT":"STRING"} maps data fields of JDBC type * FLOAT into the Java String type by calling the * ResultSet.getString() method of the driver, and uses it to build the Glue record. The * ResultSet object is implemented by each driver, so the behavior is specific to the driver you * use. Refer to the documentation for your JDBC driver to understand how the driver performs the * conversions. */ public void setDataTypeMapping(java.util.Map dataTypeMapping) { this.dataTypeMapping = dataTypeMapping; } /** *

* Custom data type mapping that builds a mapping from a JDBC data type to an Glue data type. For example, the * option "dataTypeMapping":{"FLOAT":"STRING"} maps data fields of JDBC type FLOAT into * the Java String type by calling the ResultSet.getString() method of the driver, and * uses it to build the Glue record. The ResultSet object is implemented by each driver, so the * behavior is specific to the driver you use. Refer to the documentation for your JDBC driver to understand how the * driver performs the conversions. *

* * @param dataTypeMapping * Custom data type mapping that builds a mapping from a JDBC data type to an Glue data type. For example, * the option "dataTypeMapping":{"FLOAT":"STRING"} maps data fields of JDBC type * FLOAT into the Java String type by calling the * ResultSet.getString() method of the driver, and uses it to build the Glue record. The * ResultSet object is implemented by each driver, so the behavior is specific to the driver you * use. Refer to the documentation for your JDBC driver to understand how the driver performs the * conversions. * @return Returns a reference to this object so that method calls can be chained together. */ public JDBCConnectorOptions withDataTypeMapping(java.util.Map dataTypeMapping) { setDataTypeMapping(dataTypeMapping); return this; } /** * Add a single DataTypeMapping entry * * @see JDBCConnectorOptions#withDataTypeMapping * @returns a reference to this object so that method calls can be chained together. */ public JDBCConnectorOptions addDataTypeMappingEntry(String key, String value) { if (null == this.dataTypeMapping) { this.dataTypeMapping = new java.util.HashMap(); } if (this.dataTypeMapping.containsKey(key)) throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided."); this.dataTypeMapping.put(key, value); return this; } /** * Removes all the entries added into DataTypeMapping. * * @return Returns a reference to this object so that method calls can be chained together. */ public JDBCConnectorOptions clearDataTypeMappingEntries() { this.dataTypeMapping = 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 (getFilterPredicate() != null) sb.append("FilterPredicate: ").append(getFilterPredicate()).append(","); if (getPartitionColumn() != null) sb.append("PartitionColumn: ").append(getPartitionColumn()).append(","); if (getLowerBound() != null) sb.append("LowerBound: ").append(getLowerBound()).append(","); if (getUpperBound() != null) sb.append("UpperBound: ").append(getUpperBound()).append(","); if (getNumPartitions() != null) sb.append("NumPartitions: ").append(getNumPartitions()).append(","); if (getJobBookmarkKeys() != null) sb.append("JobBookmarkKeys: ").append(getJobBookmarkKeys()).append(","); if (getJobBookmarkKeysSortOrder() != null) sb.append("JobBookmarkKeysSortOrder: ").append(getJobBookmarkKeysSortOrder()).append(","); if (getDataTypeMapping() != null) sb.append("DataTypeMapping: ").append(getDataTypeMapping()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof JDBCConnectorOptions == false) return false; JDBCConnectorOptions other = (JDBCConnectorOptions) obj; if (other.getFilterPredicate() == null ^ this.getFilterPredicate() == null) return false; if (other.getFilterPredicate() != null && other.getFilterPredicate().equals(this.getFilterPredicate()) == false) return false; if (other.getPartitionColumn() == null ^ this.getPartitionColumn() == null) return false; if (other.getPartitionColumn() != null && other.getPartitionColumn().equals(this.getPartitionColumn()) == false) return false; if (other.getLowerBound() == null ^ this.getLowerBound() == null) return false; if (other.getLowerBound() != null && other.getLowerBound().equals(this.getLowerBound()) == false) return false; if (other.getUpperBound() == null ^ this.getUpperBound() == null) return false; if (other.getUpperBound() != null && other.getUpperBound().equals(this.getUpperBound()) == false) return false; if (other.getNumPartitions() == null ^ this.getNumPartitions() == null) return false; if (other.getNumPartitions() != null && other.getNumPartitions().equals(this.getNumPartitions()) == false) return false; if (other.getJobBookmarkKeys() == null ^ this.getJobBookmarkKeys() == null) return false; if (other.getJobBookmarkKeys() != null && other.getJobBookmarkKeys().equals(this.getJobBookmarkKeys()) == false) return false; if (other.getJobBookmarkKeysSortOrder() == null ^ this.getJobBookmarkKeysSortOrder() == null) return false; if (other.getJobBookmarkKeysSortOrder() != null && other.getJobBookmarkKeysSortOrder().equals(this.getJobBookmarkKeysSortOrder()) == false) return false; if (other.getDataTypeMapping() == null ^ this.getDataTypeMapping() == null) return false; if (other.getDataTypeMapping() != null && other.getDataTypeMapping().equals(this.getDataTypeMapping()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getFilterPredicate() == null) ? 0 : getFilterPredicate().hashCode()); hashCode = prime * hashCode + ((getPartitionColumn() == null) ? 0 : getPartitionColumn().hashCode()); hashCode = prime * hashCode + ((getLowerBound() == null) ? 0 : getLowerBound().hashCode()); hashCode = prime * hashCode + ((getUpperBound() == null) ? 0 : getUpperBound().hashCode()); hashCode = prime * hashCode + ((getNumPartitions() == null) ? 0 : getNumPartitions().hashCode()); hashCode = prime * hashCode + ((getJobBookmarkKeys() == null) ? 0 : getJobBookmarkKeys().hashCode()); hashCode = prime * hashCode + ((getJobBookmarkKeysSortOrder() == null) ? 0 : getJobBookmarkKeysSortOrder().hashCode()); hashCode = prime * hashCode + ((getDataTypeMapping() == null) ? 0 : getDataTypeMapping().hashCode()); return hashCode; } @Override public JDBCConnectorOptions clone() { try { return (JDBCConnectorOptions) 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.JDBCConnectorOptionsMarshaller.getInstance().marshall(this, protocolMarshaller); } }