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

com.azure.resourcemanager.hybridcompute.models.VolumeLicenseDetails Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for HybridCompute Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The Hybrid Compute Management Client. Package tag package-preview-2024-07.

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.hybridcompute.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 VolumeLicenseDetails model.
 */
@Fluent
public final class VolumeLicenseDetails implements JsonSerializable {
    /*
     * Describes the program year the volume license is for.
     */
    private ProgramYear programYear;

    /*
     * The invoice id for the volume license.
     */
    private String invoiceId;

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

    /**
     * Get the programYear property: Describes the program year the volume license is for.
     * 
     * @return the programYear value.
     */
    public ProgramYear programYear() {
        return this.programYear;
    }

    /**
     * Set the programYear property: Describes the program year the volume license is for.
     * 
     * @param programYear the programYear value to set.
     * @return the VolumeLicenseDetails object itself.
     */
    public VolumeLicenseDetails withProgramYear(ProgramYear programYear) {
        this.programYear = programYear;
        return this;
    }

    /**
     * Get the invoiceId property: The invoice id for the volume license.
     * 
     * @return the invoiceId value.
     */
    public String invoiceId() {
        return this.invoiceId;
    }

    /**
     * Set the invoiceId property: The invoice id for the volume license.
     * 
     * @param invoiceId the invoiceId value to set.
     * @return the VolumeLicenseDetails object itself.
     */
    public VolumeLicenseDetails withInvoiceId(String invoiceId) {
        this.invoiceId = invoiceId;
        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.writeStringField("programYear", this.programYear == null ? null : this.programYear.toString());
        jsonWriter.writeStringField("invoiceId", this.invoiceId);
        return jsonWriter.writeEndObject();
    }

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

                if ("programYear".equals(fieldName)) {
                    deserializedVolumeLicenseDetails.programYear = ProgramYear.fromString(reader.getString());
                } else if ("invoiceId".equals(fieldName)) {
                    deserializedVolumeLicenseDetails.invoiceId = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedVolumeLicenseDetails;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy