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

com.azure.resourcemanager.billing.models.MoveProductErrorDetails 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.Immutable;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;

/**
 * Error details of the transfer eligibility validation.
 */
@Immutable
public class MoveProductErrorDetails implements JsonSerializable {
    /*
     * Error code for the product transfer validation.
     */
    private MoveValidationErrorCode code;

    /*
     * The error message.
     */
    private String message;

    /*
     * Error details of the transfer eligibility validation.
     */
    private String details;

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

    /**
     * Get the code property: Error code for the product transfer validation.
     * 
     * @return the code value.
     */
    public MoveValidationErrorCode code() {
        return this.code;
    }

    /**
     * Set the code property: Error code for the product transfer validation.
     * 
     * @param code the code value to set.
     * @return the MoveProductErrorDetails object itself.
     */
    MoveProductErrorDetails withCode(MoveValidationErrorCode code) {
        this.code = code;
        return this;
    }

    /**
     * Get the message property: The error message.
     * 
     * @return the message value.
     */
    public String message() {
        return this.message;
    }

    /**
     * Set the message property: The error message.
     * 
     * @param message the message value to set.
     * @return the MoveProductErrorDetails object itself.
     */
    MoveProductErrorDetails withMessage(String message) {
        this.message = message;
        return this;
    }

    /**
     * Get the details property: Error details of the transfer eligibility validation.
     * 
     * @return the details value.
     */
    public String details() {
        return this.details;
    }

    /**
     * Set the details property: Error details of the transfer eligibility validation.
     * 
     * @param details the details value to set.
     * @return the MoveProductErrorDetails object itself.
     */
    MoveProductErrorDetails withDetails(String details) {
        this.details = details;
        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();
        return jsonWriter.writeEndObject();
    }

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

                if ("code".equals(fieldName)) {
                    deserializedMoveProductErrorDetails.code = MoveValidationErrorCode.fromString(reader.getString());
                } else if ("message".equals(fieldName)) {
                    deserializedMoveProductErrorDetails.message = reader.getString();
                } else if ("details".equals(fieldName)) {
                    deserializedMoveProductErrorDetails.details = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedMoveProductErrorDetails;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy