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

com.azure.resourcemanager.datafactory.models.DataMapperMapping 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;

/**
 * Source and target table mapping details.
 */
@Fluent
public final class DataMapperMapping implements JsonSerializable {
    /*
     * Name of the target table
     */
    private String targetEntityName;

    /*
     * Name of the source table
     */
    private String sourceEntityName;

    /*
     * The connection reference for the source connection.
     */
    private MapperConnectionReference sourceConnectionReference;

    /*
     * This holds the user provided attribute mapping information.
     */
    private MapperAttributeMappings attributeMappingInfo;

    /*
     * This holds the source denormalization information used while joining multiple sources.
     */
    private Object sourceDenormalizeInfo;

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

    /**
     * Get the targetEntityName property: Name of the target table.
     * 
     * @return the targetEntityName value.
     */
    public String targetEntityName() {
        return this.targetEntityName;
    }

    /**
     * Set the targetEntityName property: Name of the target table.
     * 
     * @param targetEntityName the targetEntityName value to set.
     * @return the DataMapperMapping object itself.
     */
    public DataMapperMapping withTargetEntityName(String targetEntityName) {
        this.targetEntityName = targetEntityName;
        return this;
    }

    /**
     * Get the sourceEntityName property: Name of the source table.
     * 
     * @return the sourceEntityName value.
     */
    public String sourceEntityName() {
        return this.sourceEntityName;
    }

    /**
     * Set the sourceEntityName property: Name of the source table.
     * 
     * @param sourceEntityName the sourceEntityName value to set.
     * @return the DataMapperMapping object itself.
     */
    public DataMapperMapping withSourceEntityName(String sourceEntityName) {
        this.sourceEntityName = sourceEntityName;
        return this;
    }

    /**
     * Get the sourceConnectionReference property: The connection reference for the source connection.
     * 
     * @return the sourceConnectionReference value.
     */
    public MapperConnectionReference sourceConnectionReference() {
        return this.sourceConnectionReference;
    }

    /**
     * Set the sourceConnectionReference property: The connection reference for the source connection.
     * 
     * @param sourceConnectionReference the sourceConnectionReference value to set.
     * @return the DataMapperMapping object itself.
     */
    public DataMapperMapping withSourceConnectionReference(MapperConnectionReference sourceConnectionReference) {
        this.sourceConnectionReference = sourceConnectionReference;
        return this;
    }

    /**
     * Get the attributeMappingInfo property: This holds the user provided attribute mapping information.
     * 
     * @return the attributeMappingInfo value.
     */
    public MapperAttributeMappings attributeMappingInfo() {
        return this.attributeMappingInfo;
    }

    /**
     * Set the attributeMappingInfo property: This holds the user provided attribute mapping information.
     * 
     * @param attributeMappingInfo the attributeMappingInfo value to set.
     * @return the DataMapperMapping object itself.
     */
    public DataMapperMapping withAttributeMappingInfo(MapperAttributeMappings attributeMappingInfo) {
        this.attributeMappingInfo = attributeMappingInfo;
        return this;
    }

    /**
     * Get the sourceDenormalizeInfo property: This holds the source denormalization information used while joining
     * multiple sources.
     * 
     * @return the sourceDenormalizeInfo value.
     */
    public Object sourceDenormalizeInfo() {
        return this.sourceDenormalizeInfo;
    }

    /**
     * Set the sourceDenormalizeInfo property: This holds the source denormalization information used while joining
     * multiple sources.
     * 
     * @param sourceDenormalizeInfo the sourceDenormalizeInfo value to set.
     * @return the DataMapperMapping object itself.
     */
    public DataMapperMapping withSourceDenormalizeInfo(Object sourceDenormalizeInfo) {
        this.sourceDenormalizeInfo = sourceDenormalizeInfo;
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (sourceConnectionReference() != null) {
            sourceConnectionReference().validate();
        }
        if (attributeMappingInfo() != null) {
            attributeMappingInfo().validate();
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("targetEntityName", this.targetEntityName);
        jsonWriter.writeStringField("sourceEntityName", this.sourceEntityName);
        jsonWriter.writeJsonField("sourceConnectionReference", this.sourceConnectionReference);
        jsonWriter.writeJsonField("attributeMappingInfo", this.attributeMappingInfo);
        jsonWriter.writeUntypedField("sourceDenormalizeInfo", this.sourceDenormalizeInfo);
        return jsonWriter.writeEndObject();
    }

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

                if ("targetEntityName".equals(fieldName)) {
                    deserializedDataMapperMapping.targetEntityName = reader.getString();
                } else if ("sourceEntityName".equals(fieldName)) {
                    deserializedDataMapperMapping.sourceEntityName = reader.getString();
                } else if ("sourceConnectionReference".equals(fieldName)) {
                    deserializedDataMapperMapping.sourceConnectionReference
                        = MapperConnectionReference.fromJson(reader);
                } else if ("attributeMappingInfo".equals(fieldName)) {
                    deserializedDataMapperMapping.attributeMappingInfo = MapperAttributeMappings.fromJson(reader);
                } else if ("sourceDenormalizeInfo".equals(fieldName)) {
                    deserializedDataMapperMapping.sourceDenormalizeInfo = reader.readUntyped();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedDataMapperMapping;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy