com.azure.messaging.eventgrid.namespaces.models.ReceiveResult Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-messaging-eventgrid-namespaces Show documentation
Show all versions of azure-messaging-eventgrid-namespaces Show documentation
This package contains the Microsoft Azure EventGrid Namespaces client library.
The newest version!
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) TypeSpec Code Generator.
package com.azure.messaging.eventgrid.namespaces.models;
import com.azure.core.annotation.Generated;
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;
/**
* Details of the Receive operation response.
*/
@Immutable
public final class ReceiveResult implements JsonSerializable {
/*
* Array of receive responses, one per cloud event.
*/
@Generated
private final List details;
/**
* Creates an instance of ReceiveResult class.
*
* @param details the details value to set.
*/
@Generated
private ReceiveResult(List details) {
this.details = details;
}
/**
* Get the details property: Array of receive responses, one per cloud event.
*
* @return the details value.
*/
@Generated
public List getDetails() {
return this.details;
}
/**
* {@inheritDoc}
*/
@Generated
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeArrayField("value", this.details, (writer, element) -> writer.writeJson(element));
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of ReceiveResult from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of ReceiveResult if the JsonReader was pointing to an instance of it, or null if it was
* pointing to JSON null.
* @throws IllegalStateException If the deserialized JSON object was missing any required properties.
* @throws IOException If an error occurs while reading the ReceiveResult.
*/
@Generated
public static ReceiveResult fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
List details = null;
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("value".equals(fieldName)) {
details = reader.readArray(reader1 -> ReceiveDetails.fromJson(reader1));
} else {
reader.skipChildren();
}
}
return new ReceiveResult(details);
});
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy