software.amazon.awssdk.services.mturk.model.ReviewResultDetail Maven / Gradle / Ivy
Show all versions of mturk Show documentation
/*
* 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.mturk.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.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;
/**
*
* This data structure is returned multiple times for each result specified in the Review Policy.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ReviewResultDetail implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField ACTION_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ActionId").getter(getter(ReviewResultDetail::actionId)).setter(setter(Builder::actionId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ActionId").build()).build();
private static final SdkField SUBJECT_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("SubjectId").getter(getter(ReviewResultDetail::subjectId)).setter(setter(Builder::subjectId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SubjectId").build()).build();
private static final SdkField SUBJECT_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("SubjectType").getter(getter(ReviewResultDetail::subjectType)).setter(setter(Builder::subjectType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SubjectType").build()).build();
private static final SdkField QUESTION_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("QuestionId").getter(getter(ReviewResultDetail::questionId)).setter(setter(Builder::questionId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("QuestionId").build()).build();
private static final SdkField KEY_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Key")
.getter(getter(ReviewResultDetail::key)).setter(setter(Builder::key))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Key").build()).build();
private static final SdkField VALUE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Value")
.getter(getter(ReviewResultDetail::value)).setter(setter(Builder::value))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Value").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ACTION_ID_FIELD,
SUBJECT_ID_FIELD, SUBJECT_TYPE_FIELD, QUESTION_ID_FIELD, KEY_FIELD, VALUE_FIELD));
private static final long serialVersionUID = 1L;
private final String actionId;
private final String subjectId;
private final String subjectType;
private final String questionId;
private final String key;
private final String value;
private ReviewResultDetail(BuilderImpl builder) {
this.actionId = builder.actionId;
this.subjectId = builder.subjectId;
this.subjectType = builder.subjectType;
this.questionId = builder.questionId;
this.key = builder.key;
this.value = builder.value;
}
/**
*
* A unique identifier of the Review action result.
*
*
* @return A unique identifier of the Review action result.
*/
public final String actionId() {
return actionId;
}
/**
*
* The HITID or AssignmentId about which this result was taken. Note that HIT-level Review Policies will often emit
* results about both the HIT itself and its Assignments, while Assignment-level review policies generally only emit
* results about the Assignment itself.
*
*
* @return The HITID or AssignmentId about which this result was taken. Note that HIT-level Review Policies will
* often emit results about both the HIT itself and its Assignments, while Assignment-level review policies
* generally only emit results about the Assignment itself.
*/
public final String subjectId() {
return subjectId;
}
/**
*
* The type of the object from the SubjectId field.
*
*
* @return The type of the object from the SubjectId field.
*/
public final String subjectType() {
return subjectType;
}
/**
*
* Specifies the QuestionId the result is describing. Depending on whether the TargetType is a HIT or Assignment
* this results could specify multiple values. If TargetType is HIT and QuestionId is absent, then the result
* describes results of the HIT, including the HIT agreement score. If ObjectType is Assignment and QuestionId is
* absent, then the result describes the Worker's performance on the HIT.
*
*
* @return Specifies the QuestionId the result is describing. Depending on whether the TargetType is a HIT or
* Assignment this results could specify multiple values. If TargetType is HIT and QuestionId is absent,
* then the result describes results of the HIT, including the HIT agreement score. If ObjectType is
* Assignment and QuestionId is absent, then the result describes the Worker's performance on the HIT.
*/
public final String questionId() {
return questionId;
}
/**
*
* Key identifies the particular piece of reviewed information.
*
*
* @return Key identifies the particular piece of reviewed information.
*/
public final String key() {
return key;
}
/**
*
* The values of Key provided by the review policies you have selected.
*
*
* @return The values of Key provided by the review policies you have selected.
*/
public final String value() {
return value;
}
@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(actionId());
hashCode = 31 * hashCode + Objects.hashCode(subjectId());
hashCode = 31 * hashCode + Objects.hashCode(subjectType());
hashCode = 31 * hashCode + Objects.hashCode(questionId());
hashCode = 31 * hashCode + Objects.hashCode(key());
hashCode = 31 * hashCode + Objects.hashCode(value());
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 ReviewResultDetail)) {
return false;
}
ReviewResultDetail other = (ReviewResultDetail) obj;
return Objects.equals(actionId(), other.actionId()) && Objects.equals(subjectId(), other.subjectId())
&& Objects.equals(subjectType(), other.subjectType()) && Objects.equals(questionId(), other.questionId())
&& Objects.equals(key(), other.key()) && Objects.equals(value(), other.value());
}
/**
* 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("ReviewResultDetail").add("ActionId", actionId()).add("SubjectId", subjectId())
.add("SubjectType", subjectType()).add("QuestionId", questionId()).add("Key", key()).add("Value", value())
.build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "ActionId":
return Optional.ofNullable(clazz.cast(actionId()));
case "SubjectId":
return Optional.ofNullable(clazz.cast(subjectId()));
case "SubjectType":
return Optional.ofNullable(clazz.cast(subjectType()));
case "QuestionId":
return Optional.ofNullable(clazz.cast(questionId()));
case "Key":
return Optional.ofNullable(clazz.cast(key()));
case "Value":
return Optional.ofNullable(clazz.cast(value()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function