All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.azure.resourcemanager.datafactory.models.SqlPartitionSettings Maven / Gradle / Ivy

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.datafactory.models;

import com.azure.core.annotation.Fluent;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;

/**
 * The settings that will be leveraged for Sql source partitioning.
 */
@Fluent
public final class SqlPartitionSettings implements JsonSerializable {
    /*
     * The name of the column in integer or datetime type that will be used for proceeding partitioning. If not
     * specified, the primary key of the table is auto-detected and used as the partition column. Type: string (or
     * Expression with resultType string).
     */
    private Object partitionColumnName;

    /*
     * The maximum value of the partition column for partition range splitting. This value is used to decide the
     * partition stride, not for filtering the rows in table. All rows in the table or query result will be partitioned
     * and copied. Type: string (or Expression with resultType string).
     */
    private Object partitionUpperBound;

    /*
     * The minimum value of the partition column for partition range splitting. This value is used to decide the
     * partition stride, not for filtering the rows in table. All rows in the table or query result will be partitioned
     * and copied. Type: string (or Expression with resultType string).
     */
    private Object partitionLowerBound;

    /**
     * Creates an instance of SqlPartitionSettings class.
     */
    public SqlPartitionSettings() {
    }

    /**
     * Get the partitionColumnName property: The name of the column in integer or datetime type that will be used for
     * proceeding partitioning. If not specified, the primary key of the table is auto-detected and used as the
     * partition column. Type: string (or Expression with resultType string).
     * 
     * @return the partitionColumnName value.
     */
    public Object partitionColumnName() {
        return this.partitionColumnName;
    }

    /**
     * Set the partitionColumnName property: The name of the column in integer or datetime type that will be used for
     * proceeding partitioning. If not specified, the primary key of the table is auto-detected and used as the
     * partition column. Type: string (or Expression with resultType string).
     * 
     * @param partitionColumnName the partitionColumnName value to set.
     * @return the SqlPartitionSettings object itself.
     */
    public SqlPartitionSettings withPartitionColumnName(Object partitionColumnName) {
        this.partitionColumnName = partitionColumnName;
        return this;
    }

    /**
     * Get the partitionUpperBound property: The maximum value of the partition column for partition range splitting.
     * This value is used to decide the partition stride, not for filtering the rows in table. All rows in the table or
     * query result will be partitioned and copied. Type: string (or Expression with resultType string).
     * 
     * @return the partitionUpperBound value.
     */
    public Object partitionUpperBound() {
        return this.partitionUpperBound;
    }

    /**
     * Set the partitionUpperBound property: The maximum value of the partition column for partition range splitting.
     * This value is used to decide the partition stride, not for filtering the rows in table. All rows in the table or
     * query result will be partitioned and copied. Type: string (or Expression with resultType string).
     * 
     * @param partitionUpperBound the partitionUpperBound value to set.
     * @return the SqlPartitionSettings object itself.
     */
    public SqlPartitionSettings withPartitionUpperBound(Object partitionUpperBound) {
        this.partitionUpperBound = partitionUpperBound;
        return this;
    }

    /**
     * Get the partitionLowerBound property: The minimum value of the partition column for partition range splitting.
     * This value is used to decide the partition stride, not for filtering the rows in table. All rows in the table or
     * query result will be partitioned and copied. Type: string (or Expression with resultType string).
     * 
     * @return the partitionLowerBound value.
     */
    public Object partitionLowerBound() {
        return this.partitionLowerBound;
    }

    /**
     * Set the partitionLowerBound property: The minimum value of the partition column for partition range splitting.
     * This value is used to decide the partition stride, not for filtering the rows in table. All rows in the table or
     * query result will be partitioned and copied. Type: string (or Expression with resultType string).
     * 
     * @param partitionLowerBound the partitionLowerBound value to set.
     * @return the SqlPartitionSettings object itself.
     */
    public SqlPartitionSettings withPartitionLowerBound(Object partitionLowerBound) {
        this.partitionLowerBound = partitionLowerBound;
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeUntypedField("partitionColumnName", this.partitionColumnName);
        jsonWriter.writeUntypedField("partitionUpperBound", this.partitionUpperBound);
        jsonWriter.writeUntypedField("partitionLowerBound", this.partitionLowerBound);
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of SqlPartitionSettings from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of SqlPartitionSettings if the JsonReader was pointing to an instance of it, or null if it
     * was pointing to JSON null.
     * @throws IOException If an error occurs while reading the SqlPartitionSettings.
     */
    public static SqlPartitionSettings fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            SqlPartitionSettings deserializedSqlPartitionSettings = new SqlPartitionSettings();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("partitionColumnName".equals(fieldName)) {
                    deserializedSqlPartitionSettings.partitionColumnName = reader.readUntyped();
                } else if ("partitionUpperBound".equals(fieldName)) {
                    deserializedSqlPartitionSettings.partitionUpperBound = reader.readUntyped();
                } else if ("partitionLowerBound".equals(fieldName)) {
                    deserializedSqlPartitionSettings.partitionLowerBound = reader.readUntyped();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedSqlPartitionSettings;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy