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

com.azure.resourcemanager.securityinsights.models.ContentPathMap 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-2022-09.

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.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;

/**
 * The mapping of content type to a repo path.
 */
@Fluent
public final class ContentPathMap implements JsonSerializable {
    /*
     * Content type.
     */
    private ContentType contentType;

    /*
     * The path to the content.
     */
    private String path;

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

    /**
     * Get the contentType property: Content type.
     * 
     * @return the contentType value.
     */
    public ContentType contentType() {
        return this.contentType;
    }

    /**
     * Set the contentType property: Content type.
     * 
     * @param contentType the contentType value to set.
     * @return the ContentPathMap object itself.
     */
    public ContentPathMap withContentType(ContentType contentType) {
        this.contentType = contentType;
        return this;
    }

    /**
     * Get the path property: The path to the content.
     * 
     * @return the path value.
     */
    public String path() {
        return this.path;
    }

    /**
     * Set the path property: The path to the content.
     * 
     * @param path the path value to set.
     * @return the ContentPathMap object itself.
     */
    public ContentPathMap withPath(String path) {
        this.path = path;
        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("contentType", this.contentType == null ? null : this.contentType.toString());
        jsonWriter.writeStringField("path", this.path);
        return jsonWriter.writeEndObject();
    }

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

                if ("contentType".equals(fieldName)) {
                    deserializedContentPathMap.contentType = ContentType.fromString(reader.getString());
                } else if ("path".equals(fieldName)) {
                    deserializedContentPathMap.path = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedContentPathMap;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy