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

software.amazon.awssdk.services.mturk.model.Qualification Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon Mechanical Turk Requester module holds the client classes that are used for communicating with Amazon Mechanical Turk Requester Service.

There is a newer version: 2.29.39
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.mturk.model;

import java.io.Serializable;
import java.time.Instant;
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;

/**
 * 

* The Qualification data structure represents a Qualification assigned to a user, including the Qualification type and * the value (score). *

*/ @Generated("software.amazon.awssdk:codegen") public final class Qualification implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField QUALIFICATION_TYPE_ID_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("QualificationTypeId").getter(getter(Qualification::qualificationTypeId)) .setter(setter(Builder::qualificationTypeId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("QualificationTypeId").build()) .build(); private static final SdkField WORKER_ID_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("WorkerId").getter(getter(Qualification::workerId)).setter(setter(Builder::workerId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("WorkerId").build()).build(); private static final SdkField GRANT_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT) .memberName("GrantTime").getter(getter(Qualification::grantTime)).setter(setter(Builder::grantTime)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("GrantTime").build()).build(); private static final SdkField INTEGER_VALUE_FIELD = SdkField. builder(MarshallingType.INTEGER) .memberName("IntegerValue").getter(getter(Qualification::integerValue)).setter(setter(Builder::integerValue)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("IntegerValue").build()).build(); private static final SdkField LOCALE_VALUE_FIELD = SdkField. builder(MarshallingType.SDK_POJO) .memberName("LocaleValue").getter(getter(Qualification::localeValue)).setter(setter(Builder::localeValue)) .constructor(Locale::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LocaleValue").build()).build(); private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Status") .getter(getter(Qualification::statusAsString)).setter(setter(Builder::status)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(QUALIFICATION_TYPE_ID_FIELD, WORKER_ID_FIELD, GRANT_TIME_FIELD, INTEGER_VALUE_FIELD, LOCALE_VALUE_FIELD, STATUS_FIELD)); private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer(); private static final long serialVersionUID = 1L; private final String qualificationTypeId; private final String workerId; private final Instant grantTime; private final Integer integerValue; private final Locale localeValue; private final String status; private Qualification(BuilderImpl builder) { this.qualificationTypeId = builder.qualificationTypeId; this.workerId = builder.workerId; this.grantTime = builder.grantTime; this.integerValue = builder.integerValue; this.localeValue = builder.localeValue; this.status = builder.status; } /** *

* The ID of the Qualification type for the Qualification. *

* * @return The ID of the Qualification type for the Qualification. */ public final String qualificationTypeId() { return qualificationTypeId; } /** *

* The ID of the Worker who possesses the Qualification. *

* * @return The ID of the Worker who possesses the Qualification. */ public final String workerId() { return workerId; } /** *

* The date and time the Qualification was granted to the Worker. If the Worker's Qualification was revoked, and * then re-granted based on a new Qualification request, GrantTime is the date and time of the last call to the * AcceptQualificationRequest operation. *

* * @return The date and time the Qualification was granted to the Worker. If the Worker's Qualification was revoked, * and then re-granted based on a new Qualification request, GrantTime is the date and time of the last call * to the AcceptQualificationRequest operation. */ public final Instant grantTime() { return grantTime; } /** *

* The value (score) of the Qualification, if the Qualification has an integer value. *

* * @return The value (score) of the Qualification, if the Qualification has an integer value. */ public final Integer integerValue() { return integerValue; } /** * Returns the value of the LocaleValue property for this object. * * @return The value of the LocaleValue property for this object. */ public final Locale localeValue() { return localeValue; } /** *

* The status of the Qualification. Valid values are Granted | Revoked. *

*

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

* * @return The status of the Qualification. Valid values are Granted | Revoked. * @see QualificationStatus */ public final QualificationStatus status() { return QualificationStatus.fromValue(status); } /** *

* The status of the Qualification. Valid values are Granted | Revoked. *

*

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

* * @return The status of the Qualification. Valid values are Granted | Revoked. * @see QualificationStatus */ public final String statusAsString() { return status; } @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(qualificationTypeId()); hashCode = 31 * hashCode + Objects.hashCode(workerId()); hashCode = 31 * hashCode + Objects.hashCode(grantTime()); hashCode = 31 * hashCode + Objects.hashCode(integerValue()); hashCode = 31 * hashCode + Objects.hashCode(localeValue()); hashCode = 31 * hashCode + Objects.hashCode(statusAsString()); 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 Qualification)) { return false; } Qualification other = (Qualification) obj; return Objects.equals(qualificationTypeId(), other.qualificationTypeId()) && Objects.equals(workerId(), other.workerId()) && Objects.equals(grantTime(), other.grantTime()) && Objects.equals(integerValue(), other.integerValue()) && Objects.equals(localeValue(), other.localeValue()) && Objects.equals(statusAsString(), other.statusAsString()); } /** * 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("Qualification").add("QualificationTypeId", qualificationTypeId()).add("WorkerId", workerId()) .add("GrantTime", grantTime()).add("IntegerValue", integerValue()).add("LocaleValue", localeValue()) .add("Status", statusAsString()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "QualificationTypeId": return Optional.ofNullable(clazz.cast(qualificationTypeId())); case "WorkerId": return Optional.ofNullable(clazz.cast(workerId())); case "GrantTime": return Optional.ofNullable(clazz.cast(grantTime())); case "IntegerValue": return Optional.ofNullable(clazz.cast(integerValue())); case "LocaleValue": return Optional.ofNullable(clazz.cast(localeValue())); case "Status": return Optional.ofNullable(clazz.cast(statusAsString())); 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("QualificationTypeId", QUALIFICATION_TYPE_ID_FIELD); map.put("WorkerId", WORKER_ID_FIELD); map.put("GrantTime", GRANT_TIME_FIELD); map.put("IntegerValue", INTEGER_VALUE_FIELD); map.put("LocaleValue", LOCALE_VALUE_FIELD); map.put("Status", STATUS_FIELD); return Collections.unmodifiableMap(map); } private static Function getter(Function g) { return obj -> g.apply((Qualification) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The ID of the Qualification type for the Qualification. *

* * @param qualificationTypeId * The ID of the Qualification type for the Qualification. * @return Returns a reference to this object so that method calls can be chained together. */ Builder qualificationTypeId(String qualificationTypeId); /** *

* The ID of the Worker who possesses the Qualification. *

* * @param workerId * The ID of the Worker who possesses the Qualification. * @return Returns a reference to this object so that method calls can be chained together. */ Builder workerId(String workerId); /** *

* The date and time the Qualification was granted to the Worker. If the Worker's Qualification was revoked, and * then re-granted based on a new Qualification request, GrantTime is the date and time of the last call to the * AcceptQualificationRequest operation. *

* * @param grantTime * The date and time the Qualification was granted to the Worker. If the Worker's Qualification was * revoked, and then re-granted based on a new Qualification request, GrantTime is the date and time of * the last call to the AcceptQualificationRequest operation. * @return Returns a reference to this object so that method calls can be chained together. */ Builder grantTime(Instant grantTime); /** *

* The value (score) of the Qualification, if the Qualification has an integer value. *

* * @param integerValue * The value (score) of the Qualification, if the Qualification has an integer value. * @return Returns a reference to this object so that method calls can be chained together. */ Builder integerValue(Integer integerValue); /** * Sets the value of the LocaleValue property for this object. * * @param localeValue * The new value for the LocaleValue property for this object. * @return Returns a reference to this object so that method calls can be chained together. */ Builder localeValue(Locale localeValue); /** * Sets the value of the LocaleValue property for this object. * * This is a convenience method that creates an instance of the {@link Locale.Builder} avoiding the need to * create one manually via {@link Locale#builder()}. * *

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

* The status of the Qualification. Valid values are Granted | Revoked. *

* * @param status * The status of the Qualification. Valid values are Granted | Revoked. * @see QualificationStatus * @return Returns a reference to this object so that method calls can be chained together. * @see QualificationStatus */ Builder status(String status); /** *

* The status of the Qualification. Valid values are Granted | Revoked. *

* * @param status * The status of the Qualification. Valid values are Granted | Revoked. * @see QualificationStatus * @return Returns a reference to this object so that method calls can be chained together. * @see QualificationStatus */ Builder status(QualificationStatus status); } static final class BuilderImpl implements Builder { private String qualificationTypeId; private String workerId; private Instant grantTime; private Integer integerValue; private Locale localeValue; private String status; private BuilderImpl() { } private BuilderImpl(Qualification model) { qualificationTypeId(model.qualificationTypeId); workerId(model.workerId); grantTime(model.grantTime); integerValue(model.integerValue); localeValue(model.localeValue); status(model.status); } public final String getQualificationTypeId() { return qualificationTypeId; } public final void setQualificationTypeId(String qualificationTypeId) { this.qualificationTypeId = qualificationTypeId; } @Override public final Builder qualificationTypeId(String qualificationTypeId) { this.qualificationTypeId = qualificationTypeId; return this; } public final String getWorkerId() { return workerId; } public final void setWorkerId(String workerId) { this.workerId = workerId; } @Override public final Builder workerId(String workerId) { this.workerId = workerId; return this; } public final Instant getGrantTime() { return grantTime; } public final void setGrantTime(Instant grantTime) { this.grantTime = grantTime; } @Override public final Builder grantTime(Instant grantTime) { this.grantTime = grantTime; return this; } public final Integer getIntegerValue() { return integerValue; } public final void setIntegerValue(Integer integerValue) { this.integerValue = integerValue; } @Override public final Builder integerValue(Integer integerValue) { this.integerValue = integerValue; return this; } public final Locale.Builder getLocaleValue() { return localeValue != null ? localeValue.toBuilder() : null; } public final void setLocaleValue(Locale.BuilderImpl localeValue) { this.localeValue = localeValue != null ? localeValue.build() : null; } @Override public final Builder localeValue(Locale localeValue) { this.localeValue = localeValue; return this; } public final String getStatus() { return status; } public final void setStatus(String status) { this.status = status; } @Override public final Builder status(String status) { this.status = status; return this; } @Override public final Builder status(QualificationStatus status) { this.status(status == null ? null : status.toString()); return this; } @Override public Qualification build() { return new Qualification(this); } @Override public List> sdkFields() { return SDK_FIELDS; } @Override public Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy