SuggestResult.java

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.

package com.azure.search.documents.implementation.models;

import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.HashMap;
import java.util.Map;

/** A result containing a document found by a suggestion query, plus associated metadata. */
@Fluent
public final class SuggestResult {
    /*
     * The text of the suggestion result.
     */
    @JsonProperty(value = "@search.text", required = true, access = JsonProperty.Access.WRITE_ONLY)
    private String text;

    /*
     * A result containing a document found by a suggestion query, plus
     * associated metadata.
     */
    @JsonIgnore private Map<String, Object> additionalProperties;

    /**
     * Creates an instance of SuggestResult class.
     *
     * @param text the text value to set.
     */
    @JsonCreator
    public SuggestResult(
            @JsonProperty(value = "@search.text", required = true, access = JsonProperty.Access.WRITE_ONLY)
                    String text) {
        this.text = text;
    }

    /**
     * Get the text property: The text of the suggestion result.
     *
     * @return the text value.
     */
    public String getText() {
        return this.text;
    }

    /**
     * Get the additionalProperties property: A result containing a document found by a suggestion query, plus
     * associated metadata.
     *
     * @return the additionalProperties value.
     */
    @JsonAnyGetter
    public Map<String, Object> getAdditionalProperties() {
        return this.additionalProperties;
    }

    /**
     * Set the additionalProperties property: A result containing a document found by a suggestion query, plus
     * associated metadata.
     *
     * @param additionalProperties the additionalProperties value to set.
     * @return the SuggestResult object itself.
     */
    public SuggestResult setAdditionalProperties(Map<String, Object> additionalProperties) {
        this.additionalProperties = additionalProperties;
        return this;
    }

    @JsonAnySetter
    void setAdditionalProperties(String key, Object value) {
        if (additionalProperties == null) {
            additionalProperties = new HashMap<>();
        }
        additionalProperties.put(key, value);
    }
}