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

software.amazon.awssdk.services.wisdom.model.RecommendationData 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.HashMap;
import java.util.List;
import java.util.Map;
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 recommendation. *

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

* The recommended document. *

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

* The identifier of the recommendation. *

* * @return The identifier of the recommendation. */ public final String recommendationId() { return recommendationId; } /** *

* The relevance level of the recommendation. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #relevanceLevel} * will return {@link RelevanceLevel#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available * from {@link #relevanceLevelAsString}. *

* * @return The relevance level of the recommendation. * @see RelevanceLevel */ public final RelevanceLevel relevanceLevel() { return RelevanceLevel.fromValue(relevanceLevel); } /** *

* The relevance level of the recommendation. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #relevanceLevel} * will return {@link RelevanceLevel#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available * from {@link #relevanceLevelAsString}. *

* * @return The relevance level of the recommendation. * @see RelevanceLevel */ public final String relevanceLevelAsString() { return relevanceLevel; } /** *

* The relevance score of the recommendation. *

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

* The type of recommendation. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #type} will return * {@link RecommendationType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #typeAsString}. *

* * @return The type of recommendation. * @see RecommendationType */ public final RecommendationType type() { return RecommendationType.fromValue(type); } /** *

* The type of recommendation. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #type} will return * {@link RecommendationType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #typeAsString}. *

* * @return The type of recommendation. * @see RecommendationType */ public final String typeAsString() { return type; } @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(recommendationId()); hashCode = 31 * hashCode + Objects.hashCode(relevanceLevelAsString()); hashCode = 31 * hashCode + Objects.hashCode(relevanceScore()); hashCode = 31 * hashCode + Objects.hashCode(typeAsString()); 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 RecommendationData)) { return false; } RecommendationData other = (RecommendationData) obj; return Objects.equals(document(), other.document()) && Objects.equals(recommendationId(), other.recommendationId()) && Objects.equals(relevanceLevelAsString(), other.relevanceLevelAsString()) && Objects.equals(relevanceScore(), other.relevanceScore()) && Objects.equals(typeAsString(), other.typeAsString()); } /** * 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("RecommendationData").add("Document", document()).add("RecommendationId", recommendationId()) .add("RelevanceLevel", relevanceLevelAsString()).add("RelevanceScore", relevanceScore()) .add("Type", typeAsString()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "document": return Optional.ofNullable(clazz.cast(document())); case "recommendationId": return Optional.ofNullable(clazz.cast(recommendationId())); case "relevanceLevel": return Optional.ofNullable(clazz.cast(relevanceLevelAsString())); case "relevanceScore": return Optional.ofNullable(clazz.cast(relevanceScore())); case "type": return Optional.ofNullable(clazz.cast(typeAsString())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } @Override public final Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } private static Map> memberNameToFieldInitializer() { Map> map = new HashMap<>(); map.put("document", DOCUMENT_FIELD); map.put("recommendationId", RECOMMENDATION_ID_FIELD); map.put("relevanceLevel", RELEVANCE_LEVEL_FIELD); map.put("relevanceScore", RELEVANCE_SCORE_FIELD); map.put("type", TYPE_FIELD); return Collections.unmodifiableMap(map); } private static Function getter(Function g) { return obj -> g.apply((RecommendationData) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The recommended document. *

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

* The recommended 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 identifier of the recommendation. *

* * @param recommendationId * The identifier of the recommendation. * @return Returns a reference to this object so that method calls can be chained together. */ Builder recommendationId(String recommendationId); /** *

* The relevance level of the recommendation. *

* * @param relevanceLevel * The relevance level of the recommendation. * @see RelevanceLevel * @return Returns a reference to this object so that method calls can be chained together. * @see RelevanceLevel */ Builder relevanceLevel(String relevanceLevel); /** *

* The relevance level of the recommendation. *

* * @param relevanceLevel * The relevance level of the recommendation. * @see RelevanceLevel * @return Returns a reference to this object so that method calls can be chained together. * @see RelevanceLevel */ Builder relevanceLevel(RelevanceLevel relevanceLevel); /** *

* The relevance score of the recommendation. *

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

* The type of recommendation. *

* * @param type * The type of recommendation. * @see RecommendationType * @return Returns a reference to this object so that method calls can be chained together. * @see RecommendationType */ Builder type(String type); /** *

* The type of recommendation. *

* * @param type * The type of recommendation. * @see RecommendationType * @return Returns a reference to this object so that method calls can be chained together. * @see RecommendationType */ Builder type(RecommendationType type); } static final class BuilderImpl implements Builder { private Document document; private String recommendationId; private String relevanceLevel; private Double relevanceScore; private String type; private BuilderImpl() { } private BuilderImpl(RecommendationData model) { document(model.document); recommendationId(model.recommendationId); relevanceLevel(model.relevanceLevel); relevanceScore(model.relevanceScore); type(model.type); } 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 String getRecommendationId() { return recommendationId; } public final void setRecommendationId(String recommendationId) { this.recommendationId = recommendationId; } @Override public final Builder recommendationId(String recommendationId) { this.recommendationId = recommendationId; return this; } public final String getRelevanceLevel() { return relevanceLevel; } public final void setRelevanceLevel(String relevanceLevel) { this.relevanceLevel = relevanceLevel; } @Override public final Builder relevanceLevel(String relevanceLevel) { this.relevanceLevel = relevanceLevel; return this; } @Override public final Builder relevanceLevel(RelevanceLevel relevanceLevel) { this.relevanceLevel(relevanceLevel == null ? null : relevanceLevel.toString()); 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 getType() { return type; } public final void setType(String type) { this.type = type; } @Override public final Builder type(String type) { this.type = type; return this; } @Override public final Builder type(RecommendationType type) { this.type(type == null ? null : type.toString()); return this; } @Override public RecommendationData build() { return new RecommendationData(this); } @Override public List> sdkFields() { return SDK_FIELDS; } @Override public Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy