/* * Copyright 2018-2023 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 com.amazonaws.services.codecommit.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.protocol.StructuredPojo; import com.amazonaws.protocol.ProtocolMarshaller; /** *

* Returns information about a specific comment. *

* * @see AWS API * Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class Comment implements Serializable, Cloneable, StructuredPojo { /** *

* The system-generated comment ID. *

*/ private String commentId; /** *

* The content of the comment. *

*/ private String content; /** *

* The ID of the comment for which this comment is a reply, if any. *

*/ private String inReplyTo; /** *

* The date and time the comment was created, in timestamp format. *

*/ private java.util.Date creationDate; /** *

* The date and time the comment was most recently modified, in timestamp format. *

*/ private java.util.Date lastModifiedDate; /** *

* The Amazon Resource Name (ARN) of the person who posted the comment. *

*/ private String authorArn; /** *

* A Boolean value indicating whether the comment has been deleted. *

*/ private Boolean deleted; /** *

* A unique, client-generated idempotency token that, when provided in a request, ensures the request cannot be * repeated with a changed parameter. If a request is received with the same parameters and a token is included, the * request returns information about the initial request that used that token. *

*/ private String clientRequestToken; /** *

* The emoji reactions to a comment, if any, submitted by the user whose credentials are associated with the call to * the API. *

*/ private java.util.List callerReactions; /** *

* A string to integer map that represents the number of individual users who have responded to a comment with the * specified reactions. *

*/ private java.util.Map reactionCounts; /** *

* The system-generated comment ID. *

* * @param commentId * The system-generated comment ID. */ public void setCommentId(String commentId) { this.commentId = commentId; } /** *

* The system-generated comment ID. *

* * @return The system-generated comment ID. */ public String getCommentId() { return this.commentId; } /** *

* The system-generated comment ID. *

* * @param commentId * The system-generated comment ID. * @return Returns a reference to this object so that method calls can be chained together. */ public Comment withCommentId(String commentId) { setCommentId(commentId); return this; } /** *

* The content of the comment. *

* * @param content * The content of the comment. */ public void setContent(String content) { this.content = content; } /** *

* The content of the comment. *

* * @return The content of the comment. */ public String getContent() { return this.content; } /** *

* The content of the comment. *

* * @param content * The content of the comment. * @return Returns a reference to this object so that method calls can be chained together. */ public Comment withContent(String content) { setContent(content); return this; } /** *

* The ID of the comment for which this comment is a reply, if any. *

* * @param inReplyTo * The ID of the comment for which this comment is a reply, if any. */ public void setInReplyTo(String inReplyTo) { this.inReplyTo = inReplyTo; } /** *

* The ID of the comment for which this comment is a reply, if any. *

* * @return The ID of the comment for which this comment is a reply, if any. */ public String getInReplyTo() { return this.inReplyTo; } /** *

* The ID of the comment for which this comment is a reply, if any. *

* * @param inReplyTo * The ID of the comment for which this comment is a reply, if any. * @return Returns a reference to this object so that method calls can be chained together. */ public Comment withInReplyTo(String inReplyTo) { setInReplyTo(inReplyTo); return this; } /** *

* The date and time the comment was created, in timestamp format. *

* * @param creationDate * The date and time the comment was created, in timestamp format. */ public void setCreationDate(java.util.Date creationDate) { this.creationDate = creationDate; } /** *

* The date and time the comment was created, in timestamp format. *

* * @return The date and time the comment was created, in timestamp format. */ public java.util.Date getCreationDate() { return this.creationDate; } /** *

* The date and time the comment was created, in timestamp format. *

* * @param creationDate * The date and time the comment was created, in timestamp format. * @return Returns a reference to this object so that method calls can be chained together. */ public Comment withCreationDate(java.util.Date creationDate) { setCreationDate(creationDate); return this; } /** *

* The date and time the comment was most recently modified, in timestamp format. *

* * @param lastModifiedDate * The date and time the comment was most recently modified, in timestamp format. */ public void setLastModifiedDate(java.util.Date lastModifiedDate) { this.lastModifiedDate = lastModifiedDate; } /** *

* The date and time the comment was most recently modified, in timestamp format. *

* * @return The date and time the comment was most recently modified, in timestamp format. */ public java.util.Date getLastModifiedDate() { return this.lastModifiedDate; } /** *

* The date and time the comment was most recently modified, in timestamp format. *

* * @param lastModifiedDate * The date and time the comment was most recently modified, in timestamp format. * @return Returns a reference to this object so that method calls can be chained together. */ public Comment withLastModifiedDate(java.util.Date lastModifiedDate) { setLastModifiedDate(lastModifiedDate); return this; } /** *

* The Amazon Resource Name (ARN) of the person who posted the comment. *

* * @param authorArn * The Amazon Resource Name (ARN) of the person who posted the comment. */ public void setAuthorArn(String authorArn) { this.authorArn = authorArn; } /** *

* The Amazon Resource Name (ARN) of the person who posted the comment. *

* * @return The Amazon Resource Name (ARN) of the person who posted the comment. */ public String getAuthorArn() { return this.authorArn; } /** *

* The Amazon Resource Name (ARN) of the person who posted the comment. *

* * @param authorArn * The Amazon Resource Name (ARN) of the person who posted the comment. * @return Returns a reference to this object so that method calls can be chained together. */ public Comment withAuthorArn(String authorArn) { setAuthorArn(authorArn); return this; } /** *

* A Boolean value indicating whether the comment has been deleted. *

* * @param deleted * A Boolean value indicating whether the comment has been deleted. */ public void setDeleted(Boolean deleted) { this.deleted = deleted; } /** *

* A Boolean value indicating whether the comment has been deleted. *

* * @return A Boolean value indicating whether the comment has been deleted. */ public Boolean getDeleted() { return this.deleted; } /** *

* A Boolean value indicating whether the comment has been deleted. *

* * @param deleted * A Boolean value indicating whether the comment has been deleted. * @return Returns a reference to this object so that method calls can be chained together. */ public Comment withDeleted(Boolean deleted) { setDeleted(deleted); return this; } /** *

* A Boolean value indicating whether the comment has been deleted. *

* * @return A Boolean value indicating whether the comment has been deleted. */ public Boolean isDeleted() { return this.deleted; } /** *

* A unique, client-generated idempotency token that, when provided in a request, ensures the request cannot be * repeated with a changed parameter. If a request is received with the same parameters and a token is included, the * request returns information about the initial request that used that token. *

* * @param clientRequestToken * A unique, client-generated idempotency token that, when provided in a request, ensures the request cannot * be repeated with a changed parameter. If a request is received with the same parameters and a token is * included, the request returns information about the initial request that used that token. */ public void setClientRequestToken(String clientRequestToken) { this.clientRequestToken = clientRequestToken; } /** *

* A unique, client-generated idempotency token that, when provided in a request, ensures the request cannot be * repeated with a changed parameter. If a request is received with the same parameters and a token is included, the * request returns information about the initial request that used that token. *

* * @return A unique, client-generated idempotency token that, when provided in a request, ensures the request cannot * be repeated with a changed parameter. If a request is received with the same parameters and a token is * included, the request returns information about the initial request that used that token. */ public String getClientRequestToken() { return this.clientRequestToken; } /** *

* A unique, client-generated idempotency token that, when provided in a request, ensures the request cannot be * repeated with a changed parameter. If a request is received with the same parameters and a token is included, the * request returns information about the initial request that used that token. *

* * @param clientRequestToken * A unique, client-generated idempotency token that, when provided in a request, ensures the request cannot * be repeated with a changed parameter. If a request is received with the same parameters and a token is * included, the request returns information about the initial request that used that token. * @return Returns a reference to this object so that method calls can be chained together. */ public Comment withClientRequestToken(String clientRequestToken) { setClientRequestToken(clientRequestToken); return this; } /** *

* The emoji reactions to a comment, if any, submitted by the user whose credentials are associated with the call to * the API. *

* * @return The emoji reactions to a comment, if any, submitted by the user whose credentials are associated with the * call to the API. */ public java.util.List getCallerReactions() { return callerReactions; } /** *

* The emoji reactions to a comment, if any, submitted by the user whose credentials are associated with the call to * the API. *

* * @param callerReactions * The emoji reactions to a comment, if any, submitted by the user whose credentials are associated with the * call to the API. */ public void setCallerReactions(java.util.Collection callerReactions) { if (callerReactions == null) { this.callerReactions = null; return; } this.callerReactions = new java.util.ArrayList(callerReactions); } /** *

* The emoji reactions to a comment, if any, submitted by the user whose credentials are associated with the call to * the API. *

*

* NOTE: This method appends the values to the existing list (if any). Use * {@link #setCallerReactions(java.util.Collection)} or {@link #withCallerReactions(java.util.Collection)} if you * want to override the existing values. *

* * @param callerReactions * The emoji reactions to a comment, if any, submitted by the user whose credentials are associated with the * call to the API. * @return Returns a reference to this object so that method calls can be chained together. */ public Comment withCallerReactions(String... callerReactions) { if (this.callerReactions == null) { setCallerReactions(new java.util.ArrayList(callerReactions.length)); } for (String ele : callerReactions) { this.callerReactions.add(ele); } return this; } /** *

* The emoji reactions to a comment, if any, submitted by the user whose credentials are associated with the call to * the API. *

* * @param callerReactions * The emoji reactions to a comment, if any, submitted by the user whose credentials are associated with the * call to the API. * @return Returns a reference to this object so that method calls can be chained together. */ public Comment withCallerReactions(java.util.Collection callerReactions) { setCallerReactions(callerReactions); return this; } /** *

* A string to integer map that represents the number of individual users who have responded to a comment with the * specified reactions. *

* * @return A string to integer map that represents the number of individual users who have responded to a comment * with the specified reactions. */ public java.util.Map getReactionCounts() { return reactionCounts; } /** *

* A string to integer map that represents the number of individual users who have responded to a comment with the * specified reactions. *

* * @param reactionCounts * A string to integer map that represents the number of individual users who have responded to a comment * with the specified reactions. */ public void setReactionCounts(java.util.Map reactionCounts) { this.reactionCounts = reactionCounts; } /** *

* A string to integer map that represents the number of individual users who have responded to a comment with the * specified reactions. *

* * @param reactionCounts * A string to integer map that represents the number of individual users who have responded to a comment * with the specified reactions. * @return Returns a reference to this object so that method calls can be chained together. */ public Comment withReactionCounts(java.util.Map reactionCounts) { setReactionCounts(reactionCounts); return this; } /** * Add a single ReactionCounts entry * * @see Comment#withReactionCounts * @returns a reference to this object so that method calls can be chained together. */ public Comment addReactionCountsEntry(String key, Integer value) { if (null == this.reactionCounts) { this.reactionCounts = new java.util.HashMap(); } if (this.reactionCounts.containsKey(key)) throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided."); this.reactionCounts.put(key, value); return this; } /** * Removes all the entries added into ReactionCounts. * * @return Returns a reference to this object so that method calls can be chained together. */ public Comment clearReactionCountsEntries() { this.reactionCounts = null; return this; } /** * 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. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getCommentId() != null) sb.append("CommentId: ").append(getCommentId()).append(","); if (getContent() != null) sb.append("Content: ").append(getContent()).append(","); if (getInReplyTo() != null) sb.append("InReplyTo: ").append(getInReplyTo()).append(","); if (getCreationDate() != null) sb.append("CreationDate: ").append(getCreationDate()).append(","); if (getLastModifiedDate() != null) sb.append("LastModifiedDate: ").append(getLastModifiedDate()).append(","); if (getAuthorArn() != null) sb.append("AuthorArn: ").append(getAuthorArn()).append(","); if (getDeleted() != null) sb.append("Deleted: ").append(getDeleted()).append(","); if (getClientRequestToken() != null) sb.append("ClientRequestToken: ").append(getClientRequestToken()).append(","); if (getCallerReactions() != null) sb.append("CallerReactions: ").append(getCallerReactions()).append(","); if (getReactionCounts() != null) sb.append("ReactionCounts: ").append(getReactionCounts()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof Comment == false) return false; Comment other = (Comment) obj; if (other.getCommentId() == null ^ this.getCommentId() == null) return false; if (other.getCommentId() != null && other.getCommentId().equals(this.getCommentId()) == false) return false; if (other.getContent() == null ^ this.getContent() == null) return false; if (other.getContent() != null && other.getContent().equals(this.getContent()) == false) return false; if (other.getInReplyTo() == null ^ this.getInReplyTo() == null) return false; if (other.getInReplyTo() != null && other.getInReplyTo().equals(this.getInReplyTo()) == false) return false; if (other.getCreationDate() == null ^ this.getCreationDate() == null) return false; if (other.getCreationDate() != null && other.getCreationDate().equals(this.getCreationDate()) == false) return false; if (other.getLastModifiedDate() == null ^ this.getLastModifiedDate() == null) return false; if (other.getLastModifiedDate() != null && other.getLastModifiedDate().equals(this.getLastModifiedDate()) == false) return false; if (other.getAuthorArn() == null ^ this.getAuthorArn() == null) return false; if (other.getAuthorArn() != null && other.getAuthorArn().equals(this.getAuthorArn()) == false) return false; if (other.getDeleted() == null ^ this.getDeleted() == null) return false; if (other.getDeleted() != null && other.getDeleted().equals(this.getDeleted()) == false) return false; if (other.getClientRequestToken() == null ^ this.getClientRequestToken() == null) return false; if (other.getClientRequestToken() != null && other.getClientRequestToken().equals(this.getClientRequestToken()) == false) return false; if (other.getCallerReactions() == null ^ this.getCallerReactions() == null) return false; if (other.getCallerReactions() != null && other.getCallerReactions().equals(this.getCallerReactions()) == false) return false; if (other.getReactionCounts() == null ^ this.getReactionCounts() == null) return false; if (other.getReactionCounts() != null && other.getReactionCounts().equals(this.getReactionCounts()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getCommentId() == null) ? 0 : getCommentId().hashCode()); hashCode = prime * hashCode + ((getContent() == null) ? 0 : getContent().hashCode()); hashCode = prime * hashCode + ((getInReplyTo() == null) ? 0 : getInReplyTo().hashCode()); hashCode = prime * hashCode + ((getCreationDate() == null) ? 0 : getCreationDate().hashCode()); hashCode = prime * hashCode + ((getLastModifiedDate() == null) ? 0 : getLastModifiedDate().hashCode()); hashCode = prime * hashCode + ((getAuthorArn() == null) ? 0 : getAuthorArn().hashCode()); hashCode = prime * hashCode + ((getDeleted() == null) ? 0 : getDeleted().hashCode()); hashCode = prime * hashCode + ((getClientRequestToken() == null) ? 0 : getClientRequestToken().hashCode()); hashCode = prime * hashCode + ((getCallerReactions() == null) ? 0 : getCallerReactions().hashCode()); hashCode = prime * hashCode + ((getReactionCounts() == null) ? 0 : getReactionCounts().hashCode()); return hashCode; } @Override public Comment clone() { try { return (Comment) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } @com.amazonaws.annotation.SdkInternalApi @Override public void marshall(ProtocolMarshaller protocolMarshaller) { com.amazonaws.services.codecommit.model.transform.CommentMarshaller.getInstance().marshall(this, protocolMarshaller); } }