com.azure.messaging.eventgrid.namespaces.models.FailedLockToken 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.core.models.ResponseError;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
/**
* Failed LockToken information.
*/
@Immutable
public final class FailedLockToken implements JsonSerializable {
/*
* The lock token of an entry in the request.
*/
@Generated
private final String lockToken;
/*
* Error information of the failed operation result for the lock token in the request.
*/
@Generated
private final ResponseError error;
/**
* Creates an instance of FailedLockToken class.
*
* @param lockToken the lockToken value to set.
* @param error the error value to set.
*/
@Generated
private FailedLockToken(String lockToken, ResponseError error) {
this.lockToken = lockToken;
this.error = error;
}
/**
* Get the lockToken property: The lock token of an entry in the request.
*
* @return the lockToken value.
*/
@Generated
public String getLockToken() {
return this.lockToken;
}
/**
* Get the error property: Error information of the failed operation result for the lock token in the request.
*
* @return the error value.
*/
@Generated
public ResponseError getError() {
return this.error;
}
/**
* {@inheritDoc}
*/
@Generated
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("lockToken", this.lockToken);
jsonWriter.writeJsonField("error", this.error);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of FailedLockToken from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of FailedLockToken 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 FailedLockToken.
*/
@Generated
public static FailedLockToken fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
String lockToken = null;
ResponseError error = null;
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("lockToken".equals(fieldName)) {
lockToken = reader.getString();
} else if ("error".equals(fieldName)) {
error = ResponseError.fromJson(reader);
} else {
reader.skipChildren();
}
}
return new FailedLockToken(lockToken, error);
});
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy