software.amazon.awssdk.services.wisdom.model.ResultData Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of wisdom Show documentation
Show all versions of wisdom Show documentation
The AWS Java SDK for Wisdom module holds the client classes that are used for
communicating with Wisdom.
/*
* 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 extends Builder> 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
© 2015 - 2025 Weber Informatics LLC | Privacy Policy