
com.azure.resourcemanager.datafactory.models.DelimitedTextWriteSettings 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.core.util.logging.ClientLogger;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* Delimited text write settings.
*/
@Fluent
public final class DelimitedTextWriteSettings extends FormatWriteSettings {
/*
* The write setting type.
*/
private String type = "DelimitedTextWriteSettings";
/*
* Indicates whether string values should always be enclosed with quotes. Type: boolean (or Expression with
* resultType boolean).
*/
private Object quoteAllText;
/*
* The file extension used to create the files. Type: string (or Expression with resultType string).
*/
private Object fileExtension;
/*
* Limit the written file's row count to be smaller than or equal to the specified count. Type: integer (or
* Expression with resultType integer).
*/
private Object maxRowsPerFile;
/*
* Specifies the file name pattern _. when copy from non-file based store
* without partitionOptions. Type: string (or Expression with resultType string).
*/
private Object fileNamePrefix;
/**
* Creates an instance of DelimitedTextWriteSettings class.
*/
public DelimitedTextWriteSettings() {
}
/**
* Get the type property: The write setting type.
*
* @return the type value.
*/
@Override
public String type() {
return this.type;
}
/**
* Get the quoteAllText property: Indicates whether string values should always be enclosed with quotes. Type:
* boolean (or Expression with resultType boolean).
*
* @return the quoteAllText value.
*/
public Object quoteAllText() {
return this.quoteAllText;
}
/**
* Set the quoteAllText property: Indicates whether string values should always be enclosed with quotes. Type:
* boolean (or Expression with resultType boolean).
*
* @param quoteAllText the quoteAllText value to set.
* @return the DelimitedTextWriteSettings object itself.
*/
public DelimitedTextWriteSettings withQuoteAllText(Object quoteAllText) {
this.quoteAllText = quoteAllText;
return this;
}
/**
* Get the fileExtension property: The file extension used to create the files. Type: string (or Expression with
* resultType string).
*
* @return the fileExtension value.
*/
public Object fileExtension() {
return this.fileExtension;
}
/**
* Set the fileExtension property: The file extension used to create the files. Type: string (or Expression with
* resultType string).
*
* @param fileExtension the fileExtension value to set.
* @return the DelimitedTextWriteSettings object itself.
*/
public DelimitedTextWriteSettings withFileExtension(Object fileExtension) {
this.fileExtension = fileExtension;
return this;
}
/**
* Get the maxRowsPerFile property: Limit the written file's row count to be smaller than or equal to the specified
* count. Type: integer (or Expression with resultType integer).
*
* @return the maxRowsPerFile value.
*/
public Object maxRowsPerFile() {
return this.maxRowsPerFile;
}
/**
* Set the maxRowsPerFile property: Limit the written file's row count to be smaller than or equal to the specified
* count. Type: integer (or Expression with resultType integer).
*
* @param maxRowsPerFile the maxRowsPerFile value to set.
* @return the DelimitedTextWriteSettings object itself.
*/
public DelimitedTextWriteSettings withMaxRowsPerFile(Object maxRowsPerFile) {
this.maxRowsPerFile = maxRowsPerFile;
return this;
}
/**
* Get the fileNamePrefix property: Specifies the file name pattern
* <fileNamePrefix>_<fileIndex>.<fileExtension> when copy from non-file based store without
* partitionOptions. Type: string (or Expression with resultType string).
*
* @return the fileNamePrefix value.
*/
public Object fileNamePrefix() {
return this.fileNamePrefix;
}
/**
* Set the fileNamePrefix property: Specifies the file name pattern
* <fileNamePrefix>_<fileIndex>.<fileExtension> when copy from non-file based store without
* partitionOptions. Type: string (or Expression with resultType string).
*
* @param fileNamePrefix the fileNamePrefix value to set.
* @return the DelimitedTextWriteSettings object itself.
*/
public DelimitedTextWriteSettings withFileNamePrefix(Object fileNamePrefix) {
this.fileNamePrefix = fileNamePrefix;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
@Override
public void validate() {
if (fileExtension() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException(
"Missing required property fileExtension in model DelimitedTextWriteSettings"));
}
}
private static final ClientLogger LOGGER = new ClientLogger(DelimitedTextWriteSettings.class);
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeUntypedField("fileExtension", this.fileExtension);
jsonWriter.writeStringField("type", this.type);
jsonWriter.writeUntypedField("quoteAllText", this.quoteAllText);
jsonWriter.writeUntypedField("maxRowsPerFile", this.maxRowsPerFile);
jsonWriter.writeUntypedField("fileNamePrefix", this.fileNamePrefix);
if (additionalProperties() != null) {
for (Map.Entry additionalProperty : additionalProperties().entrySet()) {
jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue());
}
}
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of DelimitedTextWriteSettings from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of DelimitedTextWriteSettings if the JsonReader was pointing to an instance of it, or null if
* it was pointing to JSON null.
* @throws IllegalStateException If the deserialized JSON object was missing any required properties.
* @throws IOException If an error occurs while reading the DelimitedTextWriteSettings.
*/
public static DelimitedTextWriteSettings fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
DelimitedTextWriteSettings deserializedDelimitedTextWriteSettings = new DelimitedTextWriteSettings();
Map additionalProperties = null;
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("fileExtension".equals(fieldName)) {
deserializedDelimitedTextWriteSettings.fileExtension = reader.readUntyped();
} else if ("type".equals(fieldName)) {
deserializedDelimitedTextWriteSettings.type = reader.getString();
} else if ("quoteAllText".equals(fieldName)) {
deserializedDelimitedTextWriteSettings.quoteAllText = reader.readUntyped();
} else if ("maxRowsPerFile".equals(fieldName)) {
deserializedDelimitedTextWriteSettings.maxRowsPerFile = reader.readUntyped();
} else if ("fileNamePrefix".equals(fieldName)) {
deserializedDelimitedTextWriteSettings.fileNamePrefix = reader.readUntyped();
} else {
if (additionalProperties == null) {
additionalProperties = new LinkedHashMap<>();
}
additionalProperties.put(fieldName, reader.readUntyped());
}
}
deserializedDelimitedTextWriteSettings.withAdditionalProperties(additionalProperties);
return deserializedDelimitedTextWriteSettings;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy