All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.azure.resourcemanager.securityinsights.models.EntityExpandResponseValue Maven / Gradle / Ivy

Go to download

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.

There is a newer version: 1.0.0
Show 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.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 com.azure.resourcemanager.securityinsights.fluent.models.EntityInner;
import java.io.IOException;
import java.util.List;

/**
 * The expansion result values.
 */
@Fluent
public final class EntityExpandResponseValue implements JsonSerializable {
    /*
     * Array of the expansion result entities.
     */
    private List entities;

    /*
     * Array of edges that connects the entity to the list of entities.
     */
    private List edges;

    /**
     * Creates an instance of EntityExpandResponseValue class.
     */
    public EntityExpandResponseValue() {
    }

    /**
     * Get the entities property: Array of the expansion result entities.
     * 
     * @return the entities value.
     */
    public List entities() {
        return this.entities;
    }

    /**
     * Set the entities property: Array of the expansion result entities.
     * 
     * @param entities the entities value to set.
     * @return the EntityExpandResponseValue object itself.
     */
    public EntityExpandResponseValue withEntities(List entities) {
        this.entities = entities;
        return this;
    }

    /**
     * Get the edges property: Array of edges that connects the entity to the list of entities.
     * 
     * @return the edges value.
     */
    public List edges() {
        return this.edges;
    }

    /**
     * Set the edges property: Array of edges that connects the entity to the list of entities.
     * 
     * @param edges the edges value to set.
     * @return the EntityExpandResponseValue object itself.
     */
    public EntityExpandResponseValue withEdges(List edges) {
        this.edges = edges;
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (entities() != null) {
            entities().forEach(e -> e.validate());
        }
        if (edges() != null) {
            edges().forEach(e -> e.validate());
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeArrayField("entities", this.entities, (writer, element) -> writer.writeJson(element));
        jsonWriter.writeArrayField("edges", this.edges, (writer, element) -> writer.writeJson(element));
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of EntityExpandResponseValue from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of EntityExpandResponseValue 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 EntityExpandResponseValue.
     */
    public static EntityExpandResponseValue fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            EntityExpandResponseValue deserializedEntityExpandResponseValue = new EntityExpandResponseValue();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("entities".equals(fieldName)) {
                    List entities = reader.readArray(reader1 -> EntityInner.fromJson(reader1));
                    deserializedEntityExpandResponseValue.entities = entities;
                } else if ("edges".equals(fieldName)) {
                    List edges = reader.readArray(reader1 -> EntityEdges.fromJson(reader1));
                    deserializedEntityExpandResponseValue.edges = edges;
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedEntityExpandResponseValue;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy