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

com.azure.resourcemanager.databoxedge.models.JobErrorItem 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.databoxedge.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;
import java.util.List;

/**
 * The job error items.
 */
@Immutable
public final class JobErrorItem implements JsonSerializable {
    /*
     * The recommended actions.
     */
    private List recommendations;

    /*
     * The code intended for programmatic access.
     */
    private String code;

    /*
     * The message that describes the error in detail.
     */
    private String message;

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

    /**
     * Get the recommendations property: The recommended actions.
     * 
     * @return the recommendations value.
     */
    public List recommendations() {
        return this.recommendations;
    }

    /**
     * Get the code property: The code intended for programmatic access.
     * 
     * @return the code value.
     */
    public String code() {
        return this.code;
    }

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

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

                if ("recommendations".equals(fieldName)) {
                    List recommendations = reader.readArray(reader1 -> reader1.getString());
                    deserializedJobErrorItem.recommendations = recommendations;
                } else if ("code".equals(fieldName)) {
                    deserializedJobErrorItem.code = reader.getString();
                } else if ("message".equals(fieldName)) {
                    deserializedJobErrorItem.message = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedJobErrorItem;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy