software.amazon.awssdk.services.workdocs.model.CommentMetadata Maven / Gradle / Ivy
Show all versions of workdocs 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.workdocs.model;
import java.io.Serializable;
import java.time.Instant;
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;
/**
*
* Describes the metadata of a comment.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class CommentMetadata implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField COMMENT_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("CommentId").getter(getter(CommentMetadata::commentId)).setter(setter(Builder::commentId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CommentId").build()).build();
private static final SdkField CONTRIBUTOR_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("Contributor").getter(getter(CommentMetadata::contributor)).setter(setter(Builder::contributor))
.constructor(User::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Contributor").build()).build();
private static final SdkField CREATED_TIMESTAMP_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("CreatedTimestamp").getter(getter(CommentMetadata::createdTimestamp))
.setter(setter(Builder::createdTimestamp))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreatedTimestamp").build()).build();
private static final SdkField COMMENT_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("CommentStatus").getter(getter(CommentMetadata::commentStatusAsString))
.setter(setter(Builder::commentStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CommentStatus").build()).build();
private static final SdkField RECIPIENT_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("RecipientId").getter(getter(CommentMetadata::recipientId)).setter(setter(Builder::recipientId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RecipientId").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(COMMENT_ID_FIELD,
CONTRIBUTOR_FIELD, CREATED_TIMESTAMP_FIELD, COMMENT_STATUS_FIELD, RECIPIENT_ID_FIELD));
private static final long serialVersionUID = 1L;
private final String commentId;
private final User contributor;
private final Instant createdTimestamp;
private final String commentStatus;
private final String recipientId;
private CommentMetadata(BuilderImpl builder) {
this.commentId = builder.commentId;
this.contributor = builder.contributor;
this.createdTimestamp = builder.createdTimestamp;
this.commentStatus = builder.commentStatus;
this.recipientId = builder.recipientId;
}
/**
*
* The ID of the comment.
*
*
* @return The ID of the comment.
*/
public final String commentId() {
return commentId;
}
/**
*
* The user who made the comment.
*
*
* @return The user who made the comment.
*/
public final User contributor() {
return contributor;
}
/**
*
* The timestamp that the comment was created.
*
*
* @return The timestamp that the comment was created.
*/
public final Instant createdTimestamp() {
return createdTimestamp;
}
/**
*
* The status of the comment.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #commentStatus}
* will return {@link CommentStatusType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #commentStatusAsString}.
*
*
* @return The status of the comment.
* @see CommentStatusType
*/
public final CommentStatusType commentStatus() {
return CommentStatusType.fromValue(commentStatus);
}
/**
*
* The status of the comment.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #commentStatus}
* will return {@link CommentStatusType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #commentStatusAsString}.
*
*
* @return The status of the comment.
* @see CommentStatusType
*/
public final String commentStatusAsString() {
return commentStatus;
}
/**
*
* The ID of the user being replied to.
*
*
* @return The ID of the user being replied to.
*/
public final String recipientId() {
return recipientId;
}
@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(commentId());
hashCode = 31 * hashCode + Objects.hashCode(contributor());
hashCode = 31 * hashCode + Objects.hashCode(createdTimestamp());
hashCode = 31 * hashCode + Objects.hashCode(commentStatusAsString());
hashCode = 31 * hashCode + Objects.hashCode(recipientId());
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 CommentMetadata)) {
return false;
}
CommentMetadata other = (CommentMetadata) obj;
return Objects.equals(commentId(), other.commentId()) && Objects.equals(contributor(), other.contributor())
&& Objects.equals(createdTimestamp(), other.createdTimestamp())
&& Objects.equals(commentStatusAsString(), other.commentStatusAsString())
&& Objects.equals(recipientId(), other.recipientId());
}
/**
* 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("CommentMetadata").add("CommentId", commentId()).add("Contributor", contributor())
.add("CreatedTimestamp", createdTimestamp()).add("CommentStatus", commentStatusAsString())
.add("RecipientId", recipientId()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "CommentId":
return Optional.ofNullable(clazz.cast(commentId()));
case "Contributor":
return Optional.ofNullable(clazz.cast(contributor()));
case "CreatedTimestamp":
return Optional.ofNullable(clazz.cast(createdTimestamp()));
case "CommentStatus":
return Optional.ofNullable(clazz.cast(commentStatusAsString()));
case "RecipientId":
return Optional.ofNullable(clazz.cast(recipientId()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function