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

com.azure.resourcemanager.datafactory.models.MapperSourceConnectionsInfo 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;
import java.util.List;

/**
 * A object which contains list of tables and connection details for a source connection.
 */
@Fluent
public final class MapperSourceConnectionsInfo implements JsonSerializable {
    /*
     * List of source tables for a source connection.
     */
    private List sourceEntities;

    /*
     * Source connection details.
     */
    private MapperConnection connection;

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

    /**
     * Get the sourceEntities property: List of source tables for a source connection.
     * 
     * @return the sourceEntities value.
     */
    public List sourceEntities() {
        return this.sourceEntities;
    }

    /**
     * Set the sourceEntities property: List of source tables for a source connection.
     * 
     * @param sourceEntities the sourceEntities value to set.
     * @return the MapperSourceConnectionsInfo object itself.
     */
    public MapperSourceConnectionsInfo withSourceEntities(List sourceEntities) {
        this.sourceEntities = sourceEntities;
        return this;
    }

    /**
     * Get the connection property: Source connection details.
     * 
     * @return the connection value.
     */
    public MapperConnection connection() {
        return this.connection;
    }

    /**
     * Set the connection property: Source connection details.
     * 
     * @param connection the connection value to set.
     * @return the MapperSourceConnectionsInfo object itself.
     */
    public MapperSourceConnectionsInfo withConnection(MapperConnection connection) {
        this.connection = connection;
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (sourceEntities() != null) {
            sourceEntities().forEach(e -> e.validate());
        }
        if (connection() != null) {
            connection().validate();
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeArrayField("sourceEntities", this.sourceEntities,
            (writer, element) -> writer.writeJson(element));
        jsonWriter.writeJsonField("connection", this.connection);
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of MapperSourceConnectionsInfo from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of MapperSourceConnectionsInfo 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 MapperSourceConnectionsInfo.
     */
    public static MapperSourceConnectionsInfo fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            MapperSourceConnectionsInfo deserializedMapperSourceConnectionsInfo = new MapperSourceConnectionsInfo();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("sourceEntities".equals(fieldName)) {
                    List sourceEntities = reader.readArray(reader1 -> MapperTable.fromJson(reader1));
                    deserializedMapperSourceConnectionsInfo.sourceEntities = sourceEntities;
                } else if ("connection".equals(fieldName)) {
                    deserializedMapperSourceConnectionsInfo.connection = MapperConnection.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedMapperSourceConnectionsInfo;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy