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

com.azure.resourcemanager.automation.models.ActivityParameterSet Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for Automation Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Automation Client. Package tag package-2022-02-22.

The newest version!
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.automation.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;

/**
 * Definition of the activity parameter set.
 */
@Fluent
public final class ActivityParameterSet implements JsonSerializable {
    /*
     * Gets or sets the name of the activity parameter set.
     */
    private String name;

    /*
     * Gets or sets the parameters of the activity parameter set.
     */
    private List parameters;

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

    /**
     * Get the name property: Gets or sets the name of the activity parameter set.
     * 
     * @return the name value.
     */
    public String name() {
        return this.name;
    }

    /**
     * Set the name property: Gets or sets the name of the activity parameter set.
     * 
     * @param name the name value to set.
     * @return the ActivityParameterSet object itself.
     */
    public ActivityParameterSet withName(String name) {
        this.name = name;
        return this;
    }

    /**
     * Get the parameters property: Gets or sets the parameters of the activity parameter set.
     * 
     * @return the parameters value.
     */
    public List parameters() {
        return this.parameters;
    }

    /**
     * Set the parameters property: Gets or sets the parameters of the activity parameter set.
     * 
     * @param parameters the parameters value to set.
     * @return the ActivityParameterSet object itself.
     */
    public ActivityParameterSet withParameters(List parameters) {
        this.parameters = parameters;
        return this;
    }

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

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

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

                if ("name".equals(fieldName)) {
                    deserializedActivityParameterSet.name = reader.getString();
                } else if ("parameters".equals(fieldName)) {
                    List parameters
                        = reader.readArray(reader1 -> ActivityParameter.fromJson(reader1));
                    deserializedActivityParameterSet.parameters = parameters;
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedActivityParameterSet;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy