software.amazon.awssdk.services.wellarchitected.model.ReviewTemplateAnswer Maven / Gradle / Ivy
Show all versions of wellarchitected 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.wellarchitected.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
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 java.util.stream.Collectors;
import java.util.stream.Stream;
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.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* An answer of the question.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ReviewTemplateAnswer implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField QUESTION_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("QuestionId").getter(getter(ReviewTemplateAnswer::questionId)).setter(setter(Builder::questionId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("QuestionId").build()).build();
private static final SdkField PILLAR_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("PillarId").getter(getter(ReviewTemplateAnswer::pillarId)).setter(setter(Builder::pillarId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PillarId").build()).build();
private static final SdkField QUESTION_TITLE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("QuestionTitle").getter(getter(ReviewTemplateAnswer::questionTitle))
.setter(setter(Builder::questionTitle))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("QuestionTitle").build()).build();
private static final SdkField QUESTION_DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("QuestionDescription").getter(getter(ReviewTemplateAnswer::questionDescription))
.setter(setter(Builder::questionDescription))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("QuestionDescription").build())
.build();
private static final SdkField IMPROVEMENT_PLAN_URL_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ImprovementPlanUrl").getter(getter(ReviewTemplateAnswer::improvementPlanUrl))
.setter(setter(Builder::improvementPlanUrl))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ImprovementPlanUrl").build())
.build();
private static final SdkField HELPFUL_RESOURCE_URL_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("HelpfulResourceUrl").getter(getter(ReviewTemplateAnswer::helpfulResourceUrl))
.setter(setter(Builder::helpfulResourceUrl))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("HelpfulResourceUrl").build())
.build();
private static final SdkField HELPFUL_RESOURCE_DISPLAY_TEXT_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("HelpfulResourceDisplayText")
.getter(getter(ReviewTemplateAnswer::helpfulResourceDisplayText))
.setter(setter(Builder::helpfulResourceDisplayText))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("HelpfulResourceDisplayText").build())
.build();
private static final SdkField> CHOICES_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("Choices")
.getter(getter(ReviewTemplateAnswer::choices))
.setter(setter(Builder::choices))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Choices").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(Choice::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField> SELECTED_CHOICES_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("SelectedChoices")
.getter(getter(ReviewTemplateAnswer::selectedChoices))
.setter(setter(Builder::selectedChoices))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SelectedChoices").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField> CHOICE_ANSWERS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("ChoiceAnswers")
.getter(getter(ReviewTemplateAnswer::choiceAnswers))
.setter(setter(Builder::choiceAnswers))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ChoiceAnswers").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(ChoiceAnswer::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField IS_APPLICABLE_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("IsApplicable").getter(getter(ReviewTemplateAnswer::isApplicable)).setter(setter(Builder::isApplicable))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("IsApplicable").build()).build();
private static final SdkField ANSWER_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AnswerStatus").getter(getter(ReviewTemplateAnswer::answerStatusAsString))
.setter(setter(Builder::answerStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AnswerStatus").build()).build();
private static final SdkField NOTES_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Notes")
.getter(getter(ReviewTemplateAnswer::notes)).setter(setter(Builder::notes))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Notes").build()).build();
private static final SdkField REASON_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Reason")
.getter(getter(ReviewTemplateAnswer::reasonAsString)).setter(setter(Builder::reason))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Reason").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(QUESTION_ID_FIELD,
PILLAR_ID_FIELD, QUESTION_TITLE_FIELD, QUESTION_DESCRIPTION_FIELD, IMPROVEMENT_PLAN_URL_FIELD,
HELPFUL_RESOURCE_URL_FIELD, HELPFUL_RESOURCE_DISPLAY_TEXT_FIELD, CHOICES_FIELD, SELECTED_CHOICES_FIELD,
CHOICE_ANSWERS_FIELD, IS_APPLICABLE_FIELD, ANSWER_STATUS_FIELD, NOTES_FIELD, REASON_FIELD));
private static final long serialVersionUID = 1L;
private final String questionId;
private final String pillarId;
private final String questionTitle;
private final String questionDescription;
private final String improvementPlanUrl;
private final String helpfulResourceUrl;
private final String helpfulResourceDisplayText;
private final List choices;
private final List selectedChoices;
private final List choiceAnswers;
private final Boolean isApplicable;
private final String answerStatus;
private final String notes;
private final String reason;
private ReviewTemplateAnswer(BuilderImpl builder) {
this.questionId = builder.questionId;
this.pillarId = builder.pillarId;
this.questionTitle = builder.questionTitle;
this.questionDescription = builder.questionDescription;
this.improvementPlanUrl = builder.improvementPlanUrl;
this.helpfulResourceUrl = builder.helpfulResourceUrl;
this.helpfulResourceDisplayText = builder.helpfulResourceDisplayText;
this.choices = builder.choices;
this.selectedChoices = builder.selectedChoices;
this.choiceAnswers = builder.choiceAnswers;
this.isApplicable = builder.isApplicable;
this.answerStatus = builder.answerStatus;
this.notes = builder.notes;
this.reason = builder.reason;
}
/**
* Returns the value of the QuestionId property for this object.
*
* @return The value of the QuestionId property for this object.
*/
public final String questionId() {
return questionId;
}
/**
* Returns the value of the PillarId property for this object.
*
* @return The value of the PillarId property for this object.
*/
public final String pillarId() {
return pillarId;
}
/**
* Returns the value of the QuestionTitle property for this object.
*
* @return The value of the QuestionTitle property for this object.
*/
public final String questionTitle() {
return questionTitle;
}
/**
* Returns the value of the QuestionDescription property for this object.
*
* @return The value of the QuestionDescription property for this object.
*/
public final String questionDescription() {
return questionDescription;
}
/**
* Returns the value of the ImprovementPlanUrl property for this object.
*
* @return The value of the ImprovementPlanUrl property for this object.
*/
public final String improvementPlanUrl() {
return improvementPlanUrl;
}
/**
* Returns the value of the HelpfulResourceUrl property for this object.
*
* @return The value of the HelpfulResourceUrl property for this object.
*/
public final String helpfulResourceUrl() {
return helpfulResourceUrl;
}
/**
*
* The helpful resource text to be displayed for a custom lens.
*
*
*
* This field does not apply to Amazon Web Services official lenses.
*
*
*
* @return The helpful resource text to be displayed for a custom lens.
*
* This field does not apply to Amazon Web Services official lenses.
*
*/
public final String helpfulResourceDisplayText() {
return helpfulResourceDisplayText;
}
/**
* For responses, this returns true if the service returned a value for the Choices property. This DOES NOT check
* that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). This is
* useful because the SDK will never return a null collection or map, but you may need to differentiate between the
* service returning nothing (or null) and the service returning an empty collection or map. For requests, this
* returns true if a value for the property was specified in the request builder, and false if a value was not
* specified.
*/
public final boolean hasChoices() {
return choices != null && !(choices instanceof SdkAutoConstructList);
}
/**
* Returns the value of the Choices property for this object.
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasChoices} method.
*
*
* @return The value of the Choices property for this object.
*/
public final List choices() {
return choices;
}
/**
* For responses, this returns true if the service returned a value for the SelectedChoices property. This DOES NOT
* check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property).
* This is useful because the SDK will never return a null collection or map, but you may need to differentiate
* between the service returning nothing (or null) and the service returning an empty collection or map. For
* requests, this returns true if a value for the property was specified in the request builder, and false if a
* value was not specified.
*/
public final boolean hasSelectedChoices() {
return selectedChoices != null && !(selectedChoices instanceof SdkAutoConstructList);
}
/**
* Returns the value of the SelectedChoices property for this object.
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasSelectedChoices} method.
*
*
* @return The value of the SelectedChoices property for this object.
*/
public final List selectedChoices() {
return selectedChoices;
}
/**
* For responses, this returns true if the service returned a value for the ChoiceAnswers property. This DOES NOT
* check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property).
* This is useful because the SDK will never return a null collection or map, but you may need to differentiate
* between the service returning nothing (or null) and the service returning an empty collection or map. For
* requests, this returns true if a value for the property was specified in the request builder, and false if a
* value was not specified.
*/
public final boolean hasChoiceAnswers() {
return choiceAnswers != null && !(choiceAnswers instanceof SdkAutoConstructList);
}
/**
*
* A list of selected choices to a question in your review template.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasChoiceAnswers} method.
*
*
* @return A list of selected choices to a question in your review template.
*/
public final List choiceAnswers() {
return choiceAnswers;
}
/**
* Returns the value of the IsApplicable property for this object.
*
* @return The value of the IsApplicable property for this object.
*/
public final Boolean isApplicable() {
return isApplicable;
}
/**
*
* The status of whether or not this question has been answered.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #answerStatus} will
* return {@link ReviewTemplateAnswerStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #answerStatusAsString}.
*
*
* @return The status of whether or not this question has been answered.
* @see ReviewTemplateAnswerStatus
*/
public final ReviewTemplateAnswerStatus answerStatus() {
return ReviewTemplateAnswerStatus.fromValue(answerStatus);
}
/**
*
* The status of whether or not this question has been answered.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #answerStatus} will
* return {@link ReviewTemplateAnswerStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #answerStatusAsString}.
*
*
* @return The status of whether or not this question has been answered.
* @see ReviewTemplateAnswerStatus
*/
public final String answerStatusAsString() {
return answerStatus;
}
/**
* Returns the value of the Notes property for this object.
*
* @return The value of the Notes property for this object.
*/
public final String notes() {
return notes;
}
/**
*
* The reason why the question is not applicable to your review template.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #reason} will
* return {@link AnswerReason#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #reasonAsString}.
*
*
* @return The reason why the question is not applicable to your review template.
* @see AnswerReason
*/
public final AnswerReason reason() {
return AnswerReason.fromValue(reason);
}
/**
*
* The reason why the question is not applicable to your review template.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #reason} will
* return {@link AnswerReason#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #reasonAsString}.
*
*
* @return The reason why the question is not applicable to your review template.
* @see AnswerReason
*/
public final String reasonAsString() {
return reason;
}
@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(questionId());
hashCode = 31 * hashCode + Objects.hashCode(pillarId());
hashCode = 31 * hashCode + Objects.hashCode(questionTitle());
hashCode = 31 * hashCode + Objects.hashCode(questionDescription());
hashCode = 31 * hashCode + Objects.hashCode(improvementPlanUrl());
hashCode = 31 * hashCode + Objects.hashCode(helpfulResourceUrl());
hashCode = 31 * hashCode + Objects.hashCode(helpfulResourceDisplayText());
hashCode = 31 * hashCode + Objects.hashCode(hasChoices() ? choices() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasSelectedChoices() ? selectedChoices() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasChoiceAnswers() ? choiceAnswers() : null);
hashCode = 31 * hashCode + Objects.hashCode(isApplicable());
hashCode = 31 * hashCode + Objects.hashCode(answerStatusAsString());
hashCode = 31 * hashCode + Objects.hashCode(notes());
hashCode = 31 * hashCode + Objects.hashCode(reasonAsString());
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 ReviewTemplateAnswer)) {
return false;
}
ReviewTemplateAnswer other = (ReviewTemplateAnswer) obj;
return Objects.equals(questionId(), other.questionId()) && Objects.equals(pillarId(), other.pillarId())
&& Objects.equals(questionTitle(), other.questionTitle())
&& Objects.equals(questionDescription(), other.questionDescription())
&& Objects.equals(improvementPlanUrl(), other.improvementPlanUrl())
&& Objects.equals(helpfulResourceUrl(), other.helpfulResourceUrl())
&& Objects.equals(helpfulResourceDisplayText(), other.helpfulResourceDisplayText())
&& hasChoices() == other.hasChoices() && Objects.equals(choices(), other.choices())
&& hasSelectedChoices() == other.hasSelectedChoices()
&& Objects.equals(selectedChoices(), other.selectedChoices()) && hasChoiceAnswers() == other.hasChoiceAnswers()
&& Objects.equals(choiceAnswers(), other.choiceAnswers()) && Objects.equals(isApplicable(), other.isApplicable())
&& Objects.equals(answerStatusAsString(), other.answerStatusAsString()) && Objects.equals(notes(), other.notes())
&& Objects.equals(reasonAsString(), other.reasonAsString());
}
/**
* 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("ReviewTemplateAnswer").add("QuestionId", questionId()).add("PillarId", pillarId())
.add("QuestionTitle", questionTitle()).add("QuestionDescription", questionDescription())
.add("ImprovementPlanUrl", improvementPlanUrl()).add("HelpfulResourceUrl", helpfulResourceUrl())
.add("HelpfulResourceDisplayText", helpfulResourceDisplayText()).add("Choices", hasChoices() ? choices() : null)
.add("SelectedChoices", hasSelectedChoices() ? selectedChoices() : null)
.add("ChoiceAnswers", hasChoiceAnswers() ? choiceAnswers() : null).add("IsApplicable", isApplicable())
.add("AnswerStatus", answerStatusAsString()).add("Notes", notes()).add("Reason", reasonAsString()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "QuestionId":
return Optional.ofNullable(clazz.cast(questionId()));
case "PillarId":
return Optional.ofNullable(clazz.cast(pillarId()));
case "QuestionTitle":
return Optional.ofNullable(clazz.cast(questionTitle()));
case "QuestionDescription":
return Optional.ofNullable(clazz.cast(questionDescription()));
case "ImprovementPlanUrl":
return Optional.ofNullable(clazz.cast(improvementPlanUrl()));
case "HelpfulResourceUrl":
return Optional.ofNullable(clazz.cast(helpfulResourceUrl()));
case "HelpfulResourceDisplayText":
return Optional.ofNullable(clazz.cast(helpfulResourceDisplayText()));
case "Choices":
return Optional.ofNullable(clazz.cast(choices()));
case "SelectedChoices":
return Optional.ofNullable(clazz.cast(selectedChoices()));
case "ChoiceAnswers":
return Optional.ofNullable(clazz.cast(choiceAnswers()));
case "IsApplicable":
return Optional.ofNullable(clazz.cast(isApplicable()));
case "AnswerStatus":
return Optional.ofNullable(clazz.cast(answerStatusAsString()));
case "Notes":
return Optional.ofNullable(clazz.cast(notes()));
case "Reason":
return Optional.ofNullable(clazz.cast(reasonAsString()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function