
com.azure.resourcemanager.datafactory.models.DataFlowReference 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;
/**
* Data flow reference type.
*/
@Fluent
public final class DataFlowReference implements JsonSerializable {
/*
* Data flow reference type.
*/
private DataFlowReferenceType type;
/*
* Reference data flow name.
*/
private String referenceName;
/*
* Reference data flow parameters from dataset.
*/
private Object datasetParameters;
/*
* Data flow parameters
*/
private Map parameters;
/*
* Data flow reference type.
*/
private Map additionalProperties;
/**
* Creates an instance of DataFlowReference class.
*/
public DataFlowReference() {
}
/**
* Get the type property: Data flow reference type.
*
* @return the type value.
*/
public DataFlowReferenceType type() {
return this.type;
}
/**
* Set the type property: Data flow reference type.
*
* @param type the type value to set.
* @return the DataFlowReference object itself.
*/
public DataFlowReference withType(DataFlowReferenceType type) {
this.type = type;
return this;
}
/**
* Get the referenceName property: Reference data flow name.
*
* @return the referenceName value.
*/
public String referenceName() {
return this.referenceName;
}
/**
* Set the referenceName property: Reference data flow name.
*
* @param referenceName the referenceName value to set.
* @return the DataFlowReference object itself.
*/
public DataFlowReference withReferenceName(String referenceName) {
this.referenceName = referenceName;
return this;
}
/**
* Get the datasetParameters property: Reference data flow parameters from dataset.
*
* @return the datasetParameters value.
*/
public Object datasetParameters() {
return this.datasetParameters;
}
/**
* Set the datasetParameters property: Reference data flow parameters from dataset.
*
* @param datasetParameters the datasetParameters value to set.
* @return the DataFlowReference object itself.
*/
public DataFlowReference withDatasetParameters(Object datasetParameters) {
this.datasetParameters = datasetParameters;
return this;
}
/**
* Get the parameters property: Data flow parameters.
*
* @return the parameters value.
*/
public Map parameters() {
return this.parameters;
}
/**
* Set the parameters property: Data flow parameters.
*
* @param parameters the parameters value to set.
* @return the DataFlowReference object itself.
*/
public DataFlowReference withParameters(Map parameters) {
this.parameters = parameters;
return this;
}
/**
* Get the additionalProperties property: Data flow reference type.
*
* @return the additionalProperties value.
*/
public Map additionalProperties() {
return this.additionalProperties;
}
/**
* Set the additionalProperties property: Data flow reference type.
*
* @param additionalProperties the additionalProperties value to set.
* @return the DataFlowReference object itself.
*/
public DataFlowReference 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 DataFlowReference"));
}
if (referenceName() == null) {
throw LOGGER.atError()
.log(
new IllegalArgumentException("Missing required property referenceName in model DataFlowReference"));
}
}
private static final ClientLogger LOGGER = new ClientLogger(DataFlowReference.class);
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString());
jsonWriter.writeStringField("referenceName", this.referenceName);
jsonWriter.writeUntypedField("datasetParameters", this.datasetParameters);
jsonWriter.writeMapField("parameters", this.parameters, (writer, element) -> writer.writeUntyped(element));
if (additionalProperties != null) {
for (Map.Entry additionalProperty : additionalProperties.entrySet()) {
jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue());
}
}
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of DataFlowReference from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of DataFlowReference 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 DataFlowReference.
*/
public static DataFlowReference fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
DataFlowReference deserializedDataFlowReference = new DataFlowReference();
Map additionalProperties = null;
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("type".equals(fieldName)) {
deserializedDataFlowReference.type = DataFlowReferenceType.fromString(reader.getString());
} else if ("referenceName".equals(fieldName)) {
deserializedDataFlowReference.referenceName = reader.getString();
} else if ("datasetParameters".equals(fieldName)) {
deserializedDataFlowReference.datasetParameters = reader.readUntyped();
} else if ("parameters".equals(fieldName)) {
Map parameters = reader.readMap(reader1 -> reader1.readUntyped());
deserializedDataFlowReference.parameters = parameters;
} else {
if (additionalProperties == null) {
additionalProperties = new LinkedHashMap<>();
}
additionalProperties.put(fieldName, reader.readUntyped());
}
}
deserializedDataFlowReference.additionalProperties = additionalProperties;
return deserializedDataFlowReference;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy