com.azure.resourcemanager.hdinsight.models.ValidationErrorInfo Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-hdinsight Show documentation
Show all versions of azure-resourcemanager-hdinsight Show documentation
This package contains Microsoft Azure SDK for HDInsight Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. HDInsight Management Client. Package tag package-2024-08-preview.
The 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.resourcemanager.hdinsight.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;
import java.util.List;
/**
* The validation error information.
*/
@Fluent
public final class ValidationErrorInfo implements JsonSerializable {
/*
* The error code.
*/
private String code;
/*
* The error message.
*/
private String message;
/*
* The error resource.
*/
private String errorResource;
/*
* The message arguments
*/
private List messageArguments;
/**
* Creates an instance of ValidationErrorInfo class.
*/
public ValidationErrorInfo() {
}
/**
* Get the code property: The error code.
*
* @return the code value.
*/
public String code() {
return this.code;
}
/**
* Set the code property: The error code.
*
* @param code the code value to set.
* @return the ValidationErrorInfo object itself.
*/
public ValidationErrorInfo withCode(String code) {
this.code = code;
return this;
}
/**
* Get the message property: The error message.
*
* @return the message value.
*/
public String message() {
return this.message;
}
/**
* Set the message property: The error message.
*
* @param message the message value to set.
* @return the ValidationErrorInfo object itself.
*/
public ValidationErrorInfo withMessage(String message) {
this.message = message;
return this;
}
/**
* Get the errorResource property: The error resource.
*
* @return the errorResource value.
*/
public String errorResource() {
return this.errorResource;
}
/**
* Set the errorResource property: The error resource.
*
* @param errorResource the errorResource value to set.
* @return the ValidationErrorInfo object itself.
*/
public ValidationErrorInfo withErrorResource(String errorResource) {
this.errorResource = errorResource;
return this;
}
/**
* Get the messageArguments property: The message arguments.
*
* @return the messageArguments value.
*/
public List messageArguments() {
return this.messageArguments;
}
/**
* Set the messageArguments property: The message arguments.
*
* @param messageArguments the messageArguments value to set.
* @return the ValidationErrorInfo object itself.
*/
public ValidationErrorInfo withMessageArguments(List messageArguments) {
this.messageArguments = messageArguments;
return this;
}
/**
* 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();
jsonWriter.writeStringField("code", this.code);
jsonWriter.writeStringField("message", this.message);
jsonWriter.writeStringField("errorResource", this.errorResource);
jsonWriter.writeArrayField("messageArguments", this.messageArguments,
(writer, element) -> writer.writeString(element));
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of ValidationErrorInfo from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of ValidationErrorInfo 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 ValidationErrorInfo.
*/
public static ValidationErrorInfo fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
ValidationErrorInfo deserializedValidationErrorInfo = new ValidationErrorInfo();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("code".equals(fieldName)) {
deserializedValidationErrorInfo.code = reader.getString();
} else if ("message".equals(fieldName)) {
deserializedValidationErrorInfo.message = reader.getString();
} else if ("errorResource".equals(fieldName)) {
deserializedValidationErrorInfo.errorResource = reader.getString();
} else if ("messageArguments".equals(fieldName)) {
List messageArguments = reader.readArray(reader1 -> reader1.getString());
deserializedValidationErrorInfo.messageArguments = messageArguments;
} else {
reader.skipChildren();
}
}
return deserializedValidationErrorInfo;
});
}
}