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

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

/**
 * Attribute reference details for the referred column.
 */
@Fluent
public final class MapperAttributeReference implements JsonSerializable {
    /*
     * Name of the column.
     */
    private String name;

    /*
     * Name of the table.
     */
    private String entity;

    /*
     * The connection reference for the connection.
     */
    private MapperConnectionReference entityConnectionReference;

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

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

    /**
     * Set the name property: Name of the column.
     * 
     * @param name the name value to set.
     * @return the MapperAttributeReference object itself.
     */
    public MapperAttributeReference withName(String name) {
        this.name = name;
        return this;
    }

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

    /**
     * Set the entity property: Name of the table.
     * 
     * @param entity the entity value to set.
     * @return the MapperAttributeReference object itself.
     */
    public MapperAttributeReference withEntity(String entity) {
        this.entity = entity;
        return this;
    }

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

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

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("name", this.name);
        jsonWriter.writeStringField("entity", this.entity);
        jsonWriter.writeJsonField("entityConnectionReference", this.entityConnectionReference);
        return jsonWriter.writeEndObject();
    }

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

                if ("name".equals(fieldName)) {
                    deserializedMapperAttributeReference.name = reader.getString();
                } else if ("entity".equals(fieldName)) {
                    deserializedMapperAttributeReference.entity = reader.getString();
                } else if ("entityConnectionReference".equals(fieldName)) {
                    deserializedMapperAttributeReference.entityConnectionReference
                        = MapperConnectionReference.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedMapperAttributeReference;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy