
com.azure.resourcemanager.datafactory.models.DatasetCompression 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.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* The compression method used on a dataset.
*/
@Fluent
public final class DatasetCompression implements JsonSerializable {
/*
* Type of dataset compression. Type: string (or Expression with resultType string).
*/
private Object type;
/*
* The dataset compression level. Type: string (or Expression with resultType string).
*/
private Object level;
/*
* The compression method used on a dataset.
*/
private Map additionalProperties;
/**
* Creates an instance of DatasetCompression class.
*/
public DatasetCompression() {
}
/**
* Get the type property: Type of dataset compression. Type: string (or Expression with resultType string).
*
* @return the type value.
*/
public Object type() {
return this.type;
}
/**
* Set the type property: Type of dataset compression. Type: string (or Expression with resultType string).
*
* @param type the type value to set.
* @return the DatasetCompression object itself.
*/
public DatasetCompression withType(Object type) {
this.type = type;
return this;
}
/**
* Get the level property: The dataset compression level. Type: string (or Expression with resultType string).
*
* @return the level value.
*/
public Object level() {
return this.level;
}
/**
* Set the level property: The dataset compression level. Type: string (or Expression with resultType string).
*
* @param level the level value to set.
* @return the DatasetCompression object itself.
*/
public DatasetCompression withLevel(Object level) {
this.level = level;
return this;
}
/**
* Get the additionalProperties property: The compression method used on a dataset.
*
* @return the additionalProperties value.
*/
public Map additionalProperties() {
return this.additionalProperties;
}
/**
* Set the additionalProperties property: The compression method used on a dataset.
*
* @param additionalProperties the additionalProperties value to set.
* @return the DatasetCompression object itself.
*/
public DatasetCompression withAdditionalProperties(Map additionalProperties) {
this.additionalProperties = additionalProperties;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (type() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException("Missing required property type in model DatasetCompression"));
}
}
private static final ClientLogger LOGGER = new ClientLogger(DatasetCompression.class);
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeUntypedField("type", this.type);
jsonWriter.writeUntypedField("level", this.level);
if (additionalProperties != null) {
for (Map.Entry additionalProperty : additionalProperties.entrySet()) {
jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue());
}
}
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of DatasetCompression from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of DatasetCompression 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 DatasetCompression.
*/
public static DatasetCompression fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
DatasetCompression deserializedDatasetCompression = new DatasetCompression();
Map additionalProperties = null;
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("type".equals(fieldName)) {
deserializedDatasetCompression.type = reader.readUntyped();
} else if ("level".equals(fieldName)) {
deserializedDatasetCompression.level = reader.readUntyped();
} else {
if (additionalProperties == null) {
additionalProperties = new LinkedHashMap<>();
}
additionalProperties.put(fieldName, reader.readUntyped());
}
}
deserializedDatasetCompression.additionalProperties = additionalProperties;
return deserializedDatasetCompression;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy