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

software.amazon.awssdk.services.wisdom.model.ResultData Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Wisdom module holds the client classes that are used for communicating with Wisdom.

There is a newer version: 2.29.15
Show newest version
/*
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
 * the License. A copy of the License is located at
 * 
 * http://aws.amazon.com/apache2.0
 * 
 * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
 * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
 * and limitations under the License.
 */

package software.amazon.awssdk.services.wisdom.model;

import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* Information about the result. *

*/ @Generated("software.amazon.awssdk:codegen") public final class ResultData implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField DOCUMENT_FIELD = SdkField. builder(MarshallingType.SDK_POJO) .memberName("document").getter(getter(ResultData::document)).setter(setter(Builder::document)) .constructor(Document::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("document").build()).build(); private static final SdkField RELEVANCE_SCORE_FIELD = SdkField. builder(MarshallingType.DOUBLE) .memberName("relevanceScore").getter(getter(ResultData::relevanceScore)).setter(setter(Builder::relevanceScore)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("relevanceScore").build()).build(); private static final SdkField RESULT_ID_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("resultId").getter(getter(ResultData::resultId)).setter(setter(Builder::resultId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("resultId").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(DOCUMENT_FIELD, RELEVANCE_SCORE_FIELD, RESULT_ID_FIELD)); private static final long serialVersionUID = 1L; private final Document document; private final Double relevanceScore; private final String resultId; private ResultData(BuilderImpl builder) { this.document = builder.document; this.relevanceScore = builder.relevanceScore; this.resultId = builder.resultId; } /** *

* The document. *

* * @return The document. */ public final Document document() { return document; } /** *

* The relevance score of the results. *

* * @return The relevance score of the results. */ public final Double relevanceScore() { return relevanceScore; } /** *

* The identifier of the result data. *

* * @return The identifier of the result data. */ public final String resultId() { return resultId; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public final int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(document()); hashCode = 31 * hashCode + Objects.hashCode(relevanceScore()); hashCode = 31 * hashCode + Objects.hashCode(resultId()); return hashCode; } @Override public final boolean equals(Object obj) { return equalsBySdkFields(obj); } @Override public final boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof ResultData)) { return false; } ResultData other = (ResultData) obj; return Objects.equals(document(), other.document()) && Objects.equals(relevanceScore(), other.relevanceScore()) && Objects.equals(resultId(), other.resultId()); } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. */ @Override public final String toString() { return ToString.builder("ResultData").add("Document", document()).add("RelevanceScore", relevanceScore()) .add("ResultId", resultId()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "document": return Optional.ofNullable(clazz.cast(document())); case "relevanceScore": return Optional.ofNullable(clazz.cast(relevanceScore())); case "resultId": return Optional.ofNullable(clazz.cast(resultId())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((ResultData) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The document. *

* * @param document * The document. * @return Returns a reference to this object so that method calls can be chained together. */ Builder document(Document document); /** *

* The document. *

* This is a convenience method that creates an instance of the {@link Document.Builder} avoiding the need to * create one manually via {@link Document#builder()}. * *

* When the {@link Consumer} completes, {@link Document.Builder#build()} is called immediately and its result is * passed to {@link #document(Document)}. * * @param document * a consumer that will call methods on {@link Document.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #document(Document) */ default Builder document(Consumer document) { return document(Document.builder().applyMutation(document).build()); } /** *

* The relevance score of the results. *

* * @param relevanceScore * The relevance score of the results. * @return Returns a reference to this object so that method calls can be chained together. */ Builder relevanceScore(Double relevanceScore); /** *

* The identifier of the result data. *

* * @param resultId * The identifier of the result data. * @return Returns a reference to this object so that method calls can be chained together. */ Builder resultId(String resultId); } static final class BuilderImpl implements Builder { private Document document; private Double relevanceScore; private String resultId; private BuilderImpl() { } private BuilderImpl(ResultData model) { document(model.document); relevanceScore(model.relevanceScore); resultId(model.resultId); } public final Document.Builder getDocument() { return document != null ? document.toBuilder() : null; } public final void setDocument(Document.BuilderImpl document) { this.document = document != null ? document.build() : null; } @Override public final Builder document(Document document) { this.document = document; return this; } public final Double getRelevanceScore() { return relevanceScore; } public final void setRelevanceScore(Double relevanceScore) { this.relevanceScore = relevanceScore; } @Override public final Builder relevanceScore(Double relevanceScore) { this.relevanceScore = relevanceScore; return this; } public final String getResultId() { return resultId; } public final void setResultId(String resultId) { this.resultId = resultId; } @Override public final Builder resultId(String resultId) { this.resultId = resultId; return this; } @Override public ResultData build() { return new ResultData(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy