com.azure.messaging.eventgrid.namespaces.implementation.models.AcknowledgeRequest 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.implementation.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;
/**
* The AcknowledgeRequest model.
*/
@Immutable
public final class AcknowledgeRequest implements JsonSerializable {
/*
* Array of lock tokens.
*/
@Generated
private final List lockTokens;
/**
* Creates an instance of AcknowledgeRequest class.
*
* @param lockTokens the lockTokens value to set.
*/
@Generated
public AcknowledgeRequest(List lockTokens) {
this.lockTokens = lockTokens;
}
/**
* Get the lockTokens property: Array of lock tokens.
*
* @return the lockTokens value.
*/
@Generated
public List getLockTokens() {
return this.lockTokens;
}
/**
* {@inheritDoc}
*/
@Generated
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeArrayField("lockTokens", this.lockTokens, (writer, element) -> writer.writeString(element));
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of AcknowledgeRequest from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of AcknowledgeRequest 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 AcknowledgeRequest.
*/
@Generated
public static AcknowledgeRequest fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
List lockTokens = null;
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("lockTokens".equals(fieldName)) {
lockTokens = reader.readArray(reader1 -> reader1.getString());
} else {
reader.skipChildren();
}
}
return new AcknowledgeRequest(lockTokens);
});
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy