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

com.azure.messaging.eventgrid.implementation.models.AcsMessageChannelEventError Maven / Gradle / Ivy

There is a newer version: 4.27.0
Show 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.messaging.eventgrid.implementation.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;

/**
 * Message Channel Event Error.
 */
@Fluent
public final class AcsMessageChannelEventError implements JsonSerializable {
    /*
     * The channel error code
     */
    private String channelCode;

    /*
     * The channel error message
     */
    private String channelMessage;

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

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

    /**
     * Set the channelCode property: The channel error code.
     * 
     * @param channelCode the channelCode value to set.
     * @return the AcsMessageChannelEventError object itself.
     */
    public AcsMessageChannelEventError setChannelCode(String channelCode) {
        this.channelCode = channelCode;
        return this;
    }

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

    /**
     * Set the channelMessage property: The channel error message.
     * 
     * @param channelMessage the channelMessage value to set.
     * @return the AcsMessageChannelEventError object itself.
     */
    public AcsMessageChannelEventError setChannelMessage(String channelMessage) {
        this.channelMessage = channelMessage;
        return this;
    }

    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("channelCode", this.channelCode);
        jsonWriter.writeStringField("channelMessage", this.channelMessage);
        return jsonWriter.writeEndObject();
    }

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

                if ("channelCode".equals(fieldName)) {
                    deserializedAcsMessageChannelEventError.channelCode = reader.getString();
                } else if ("channelMessage".equals(fieldName)) {
                    deserializedAcsMessageChannelEventError.channelMessage = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedAcsMessageChannelEventError;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy