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

com.azure.resourcemanager.billing.models.AcceptTransferRequest 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.billing.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 com.azure.resourcemanager.billing.fluent.models.AcceptTransferProperties;
import java.io.IOException;
import java.util.List;

/**
 * Request parameters to accept transfer.
 */
@Fluent
public final class AcceptTransferRequest implements JsonSerializable {
    /*
     * Request parameters to accept transfer.
     */
    private AcceptTransferProperties innerProperties;

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

    /**
     * Get the innerProperties property: Request parameters to accept transfer.
     * 
     * @return the innerProperties value.
     */
    private AcceptTransferProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the productDetails property: Request parameters to accept transfer.
     * 
     * @return the productDetails value.
     */
    public List productDetails() {
        return this.innerProperties() == null ? null : this.innerProperties().productDetails();
    }

    /**
     * Set the productDetails property: Request parameters to accept transfer.
     * 
     * @param productDetails the productDetails value to set.
     * @return the AcceptTransferRequest object itself.
     */
    public AcceptTransferRequest withProductDetails(List productDetails) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AcceptTransferProperties();
        }
        this.innerProperties().withProductDetails(productDetails);
        return this;
    }

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

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

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

                if ("properties".equals(fieldName)) {
                    deserializedAcceptTransferRequest.innerProperties = AcceptTransferProperties.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedAcceptTransferRequest;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy