![JAR search and dependency download from the Maven repository](/logo.png)
com.azure.resourcemanager.securityinsights.models.ValidationError Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-securityinsights Show documentation
Show all versions of azure-resourcemanager-securityinsights Show documentation
This package contains Microsoft Azure SDK for SecurityInsights Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. API spec for Microsoft.SecurityInsights (Azure Security Insights) resource provider. Package tag package-preview-2021-09.
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.securityinsights.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;
/**
* Describes an error encountered in the file during validation.
*/
@Fluent
public final class ValidationError implements JsonSerializable {
/*
* The number of the record that has the error.
*/
private Integer recordIndex;
/*
* A list of descriptions of the error.
*/
private List errorMessages;
/**
* Creates an instance of ValidationError class.
*/
public ValidationError() {
}
/**
* Get the recordIndex property: The number of the record that has the error.
*
* @return the recordIndex value.
*/
public Integer recordIndex() {
return this.recordIndex;
}
/**
* Set the recordIndex property: The number of the record that has the error.
*
* @param recordIndex the recordIndex value to set.
* @return the ValidationError object itself.
*/
public ValidationError withRecordIndex(Integer recordIndex) {
this.recordIndex = recordIndex;
return this;
}
/**
* Get the errorMessages property: A list of descriptions of the error.
*
* @return the errorMessages value.
*/
public List errorMessages() {
return this.errorMessages;
}
/**
* 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.writeNumberField("recordIndex", this.recordIndex);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of ValidationError from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of ValidationError 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 ValidationError.
*/
public static ValidationError fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
ValidationError deserializedValidationError = new ValidationError();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("recordIndex".equals(fieldName)) {
deserializedValidationError.recordIndex = reader.getNullable(JsonReader::getInt);
} else if ("errorMessages".equals(fieldName)) {
List errorMessages = reader.readArray(reader1 -> reader1.getString());
deserializedValidationError.errorMessages = errorMessages;
} else {
reader.skipChildren();
}
}
return deserializedValidationError;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy