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

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

/**
 * The NodeCountProperties model.
 */
@Fluent
public final class NodeCountProperties implements JsonSerializable {
    /*
     * Gets the count for the name
     */
    private Integer count;

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

    /**
     * Get the count property: Gets the count for the name.
     * 
     * @return the count value.
     */
    public Integer count() {
        return this.count;
    }

    /**
     * Set the count property: Gets the count for the name.
     * 
     * @param count the count value to set.
     * @return the NodeCountProperties object itself.
     */
    public NodeCountProperties withCount(Integer count) {
        this.count = count;
        return this;
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeNumberField("count", this.count);
        return jsonWriter.writeEndObject();
    }

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

                if ("count".equals(fieldName)) {
                    deserializedNodeCountProperties.count = reader.getNullable(JsonReader::getInt);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedNodeCountProperties;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy