software.amazon.awssdk.services.connect.model.EvaluationFormQuestion Maven / Gradle / Ivy
Show all versions of connect 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.connect.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 a question from an evaluation form.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class EvaluationFormQuestion implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField TITLE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Title")
.getter(getter(EvaluationFormQuestion::title)).setter(setter(Builder::title))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Title").build()).build();
private static final SdkField INSTRUCTIONS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Instructions").getter(getter(EvaluationFormQuestion::instructions))
.setter(setter(Builder::instructions))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Instructions").build()).build();
private static final SdkField REF_ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("RefId")
.getter(getter(EvaluationFormQuestion::refId)).setter(setter(Builder::refId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RefId").build()).build();
private static final SdkField NOT_APPLICABLE_ENABLED_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("NotApplicableEnabled").getter(getter(EvaluationFormQuestion::notApplicableEnabled))
.setter(setter(Builder::notApplicableEnabled))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NotApplicableEnabled").build())
.build();
private static final SdkField QUESTION_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("QuestionType").getter(getter(EvaluationFormQuestion::questionTypeAsString))
.setter(setter(Builder::questionType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("QuestionType").build()).build();
private static final SdkField QUESTION_TYPE_PROPERTIES_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("QuestionTypeProperties")
.getter(getter(EvaluationFormQuestion::questionTypeProperties)).setter(setter(Builder::questionTypeProperties))
.constructor(EvaluationFormQuestionTypeProperties::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("QuestionTypeProperties").build())
.build();
private static final SdkField WEIGHT_FIELD = SdkField. builder(MarshallingType.DOUBLE).memberName("Weight")
.getter(getter(EvaluationFormQuestion::weight)).setter(setter(Builder::weight))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Weight").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(TITLE_FIELD,
INSTRUCTIONS_FIELD, REF_ID_FIELD, NOT_APPLICABLE_ENABLED_FIELD, QUESTION_TYPE_FIELD, QUESTION_TYPE_PROPERTIES_FIELD,
WEIGHT_FIELD));
private static final long serialVersionUID = 1L;
private final String title;
private final String instructions;
private final String refId;
private final Boolean notApplicableEnabled;
private final String questionType;
private final EvaluationFormQuestionTypeProperties questionTypeProperties;
private final Double weight;
private EvaluationFormQuestion(BuilderImpl builder) {
this.title = builder.title;
this.instructions = builder.instructions;
this.refId = builder.refId;
this.notApplicableEnabled = builder.notApplicableEnabled;
this.questionType = builder.questionType;
this.questionTypeProperties = builder.questionTypeProperties;
this.weight = builder.weight;
}
/**
*
* The title of the question.
*
*
* @return The title of the question.
*/
public final String title() {
return title;
}
/**
*
* The instructions of the section.
*
*
* @return The instructions of the section.
*/
public final String instructions() {
return instructions;
}
/**
*
* The identifier of the question. An identifier must be unique within the evaluation form.
*
*
* @return The identifier of the question. An identifier must be unique within the evaluation form.
*/
public final String refId() {
return refId;
}
/**
*
* The flag to enable not applicable answers to the question.
*
*
* @return The flag to enable not applicable answers to the question.
*/
public final Boolean notApplicableEnabled() {
return notApplicableEnabled;
}
/**
*
* The type of the question.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #questionType} will
* return {@link EvaluationFormQuestionType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #questionTypeAsString}.
*
*
* @return The type of the question.
* @see EvaluationFormQuestionType
*/
public final EvaluationFormQuestionType questionType() {
return EvaluationFormQuestionType.fromValue(questionType);
}
/**
*
* The type of the question.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #questionType} will
* return {@link EvaluationFormQuestionType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #questionTypeAsString}.
*
*
* @return The type of the question.
* @see EvaluationFormQuestionType
*/
public final String questionTypeAsString() {
return questionType;
}
/**
*
* The properties of the type of question. Text questions do not have to define question type properties.
*
*
* @return The properties of the type of question. Text questions do not have to define question type properties.
*/
public final EvaluationFormQuestionTypeProperties questionTypeProperties() {
return questionTypeProperties;
}
/**
*
* The scoring weight of the section.
*
*
* @return The scoring weight of the section.
*/
public final Double weight() {
return weight;
}
@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(title());
hashCode = 31 * hashCode + Objects.hashCode(instructions());
hashCode = 31 * hashCode + Objects.hashCode(refId());
hashCode = 31 * hashCode + Objects.hashCode(notApplicableEnabled());
hashCode = 31 * hashCode + Objects.hashCode(questionTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(questionTypeProperties());
hashCode = 31 * hashCode + Objects.hashCode(weight());
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 EvaluationFormQuestion)) {
return false;
}
EvaluationFormQuestion other = (EvaluationFormQuestion) obj;
return Objects.equals(title(), other.title()) && Objects.equals(instructions(), other.instructions())
&& Objects.equals(refId(), other.refId()) && Objects.equals(notApplicableEnabled(), other.notApplicableEnabled())
&& Objects.equals(questionTypeAsString(), other.questionTypeAsString())
&& Objects.equals(questionTypeProperties(), other.questionTypeProperties())
&& Objects.equals(weight(), other.weight());
}
/**
* 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("EvaluationFormQuestion").add("Title", title()).add("Instructions", instructions())
.add("RefId", refId()).add("NotApplicableEnabled", notApplicableEnabled())
.add("QuestionType", questionTypeAsString()).add("QuestionTypeProperties", questionTypeProperties())
.add("Weight", weight()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Title":
return Optional.ofNullable(clazz.cast(title()));
case "Instructions":
return Optional.ofNullable(clazz.cast(instructions()));
case "RefId":
return Optional.ofNullable(clazz.cast(refId()));
case "NotApplicableEnabled":
return Optional.ofNullable(clazz.cast(notApplicableEnabled()));
case "QuestionType":
return Optional.ofNullable(clazz.cast(questionTypeAsString()));
case "QuestionTypeProperties":
return Optional.ofNullable(clazz.cast(questionTypeProperties()));
case "Weight":
return Optional.ofNullable(clazz.cast(weight()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function