/* * Copyright 2010-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.chimesdkmessaging.model; import java.io.Serializable; /** *

* The membership information, including member ARNs, the channel ARN, and * membership types. *

*/ public class BatchChannelMemberships implements Serializable { /** *

* The identifier of the member who invited another member. *

*/ private Identity invitedBy; /** *

* The membership types set for the channel members. *

*

* Constraints:
* Allowed Values: DEFAULT, HIDDEN */ private String type; /** *

* The users successfully added to the request. *

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

* The ARN of the channel to which you're adding members. *

*

* Constraints:
* Length: 5 - 1600
* Pattern: * arn:[a-z0-9-\.]{1,63}:[a-z0-9-\.]{0,63}:[a-z0-9-\.]{0,63}: * [a-z0-9-\.]{0,63}:[^/].{0,1023}
*/ private String channelArn; /** *

* The ID of the SubChannel. *

*

* Constraints:
* Length: 1 - 128
* Pattern: [-_a-zA-Z0-9]*
*/ private String subChannelId; /** *

* The identifier of the member who invited another member. *

* * @return

* The identifier of the member who invited another member. *

*/ public Identity getInvitedBy() { return invitedBy; } /** *

* The identifier of the member who invited another member. *

* * @param invitedBy

* The identifier of the member who invited another member. *

*/ public void setInvitedBy(Identity invitedBy) { this.invitedBy = invitedBy; } /** *

* The identifier of the member who invited another member. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param invitedBy

* The identifier of the member who invited another member. *

* @return A reference to this updated object so that method calls can be * chained together. */ public BatchChannelMemberships withInvitedBy(Identity invitedBy) { this.invitedBy = invitedBy; return this; } /** *

* The membership types set for the channel members. *

*

* Constraints:
* Allowed Values: DEFAULT, HIDDEN * * @return

* The membership types set for the channel members. *

* @see ChannelMembershipType */ public String getType() { return type; } /** *

* The membership types set for the channel members. *

*

* Constraints:
* Allowed Values: DEFAULT, HIDDEN * * @param type

* The membership types set for the channel members. *

* @see ChannelMembershipType */ public void setType(String type) { this.type = type; } /** *

* The membership types set for the channel members. *

*

* Returns a reference to this object so that method calls can be chained * together. *

* Constraints:
* Allowed Values: DEFAULT, HIDDEN * * @param type

* The membership types set for the channel members. *

* @return A reference to this updated object so that method calls can be * chained together. * @see ChannelMembershipType */ public BatchChannelMemberships withType(String type) { this.type = type; return this; } /** *

* The membership types set for the channel members. *

*

* Constraints:
* Allowed Values: DEFAULT, HIDDEN * * @param type

* The membership types set for the channel members. *

* @see ChannelMembershipType */ public void setType(ChannelMembershipType type) { this.type = type.toString(); } /** *

* The membership types set for the channel members. *

*

* Returns a reference to this object so that method calls can be chained * together. *

* Constraints:
* Allowed Values: DEFAULT, HIDDEN * * @param type

* The membership types set for the channel members. *

* @return A reference to this updated object so that method calls can be * chained together. * @see ChannelMembershipType */ public BatchChannelMemberships withType(ChannelMembershipType type) { this.type = type.toString(); return this; } /** *

* The users successfully added to the request. *

* * @return

* The users successfully added to the request. *

*/ public java.util.List getMembers() { return members; } /** *

* The users successfully added to the request. *

* * @param members

* The users successfully added to the request. *

*/ public void setMembers(java.util.Collection members) { if (members == null) { this.members = null; return; } this.members = new java.util.ArrayList(members); } /** *

* The users successfully added to the request. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param members

* The users successfully added to the request. *

* @return A reference to this updated object so that method calls can be * chained together. */ public BatchChannelMemberships withMembers(Identity... members) { if (getMembers() == null) { this.members = new java.util.ArrayList(members.length); } for (Identity value : members) { this.members.add(value); } return this; } /** *

* The users successfully added to the request. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param members

* The users successfully added to the request. *

* @return A reference to this updated object so that method calls can be * chained together. */ public BatchChannelMemberships withMembers(java.util.Collection members) { setMembers(members); return this; } /** *

* The ARN of the channel to which you're adding members. *

*

* Constraints:
* Length: 5 - 1600
* Pattern: * arn:[a-z0-9-\.]{1,63}:[a-z0-9-\.]{0,63}:[a-z0-9-\.]{0,63}: * [a-z0-9-\.]{0,63}:[^/].{0,1023}
* * @return

* The ARN of the channel to which you're adding members. *

*/ public String getChannelArn() { return channelArn; } /** *

* The ARN of the channel to which you're adding members. *

*

* Constraints:
* Length: 5 - 1600
* Pattern: * arn:[a-z0-9-\.]{1,63}:[a-z0-9-\.]{0,63}:[a-z0-9-\.]{0,63}: * [a-z0-9-\.]{0,63}:[^/].{0,1023}
* * @param channelArn

* The ARN of the channel to which you're adding members. *

*/ public void setChannelArn(String channelArn) { this.channelArn = channelArn; } /** *

* The ARN of the channel to which you're adding members. *

*

* Returns a reference to this object so that method calls can be chained * together. *

* Constraints:
* Length: 5 - 1600
* Pattern: * arn:[a-z0-9-\.]{1,63}:[a-z0-9-\.]{0,63}:[a-z0-9-\.]{0,63}: * [a-z0-9-\.]{0,63}:[^/].{0,1023}
* * @param channelArn

* The ARN of the channel to which you're adding members. *

* @return A reference to this updated object so that method calls can be * chained together. */ public BatchChannelMemberships withChannelArn(String channelArn) { this.channelArn = channelArn; return this; } /** *

* The ID of the SubChannel. *

*

* Constraints:
* Length: 1 - 128
* Pattern: [-_a-zA-Z0-9]*
* * @return

* The ID of the SubChannel. *

*/ public String getSubChannelId() { return subChannelId; } /** *

* The ID of the SubChannel. *

*

* Constraints:
* Length: 1 - 128
* Pattern: [-_a-zA-Z0-9]*
* * @param subChannelId

* The ID of the SubChannel. *

*/ public void setSubChannelId(String subChannelId) { this.subChannelId = subChannelId; } /** *

* The ID of the SubChannel. *

*

* Returns a reference to this object so that method calls can be chained * together. *

* Constraints:
* Length: 1 - 128
* Pattern: [-_a-zA-Z0-9]*
* * @param subChannelId

* The ID of the SubChannel. *

* @return A reference to this updated object so that method calls can be * chained together. */ public BatchChannelMemberships withSubChannelId(String subChannelId) { this.subChannelId = subChannelId; return this; } /** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getInvitedBy() != null) sb.append("InvitedBy: " + getInvitedBy() + ","); if (getType() != null) sb.append("Type: " + getType() + ","); if (getMembers() != null) sb.append("Members: " + getMembers() + ","); if (getChannelArn() != null) sb.append("ChannelArn: " + getChannelArn() + ","); if (getSubChannelId() != null) sb.append("SubChannelId: " + getSubChannelId()); sb.append("}"); return sb.toString(); } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getInvitedBy() == null) ? 0 : getInvitedBy().hashCode()); hashCode = prime * hashCode + ((getType() == null) ? 0 : getType().hashCode()); hashCode = prime * hashCode + ((getMembers() == null) ? 0 : getMembers().hashCode()); hashCode = prime * hashCode + ((getChannelArn() == null) ? 0 : getChannelArn().hashCode()); hashCode = prime * hashCode + ((getSubChannelId() == null) ? 0 : getSubChannelId().hashCode()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof BatchChannelMemberships == false) return false; BatchChannelMemberships other = (BatchChannelMemberships) obj; if (other.getInvitedBy() == null ^ this.getInvitedBy() == null) return false; if (other.getInvitedBy() != null && other.getInvitedBy().equals(this.getInvitedBy()) == false) return false; if (other.getType() == null ^ this.getType() == null) return false; if (other.getType() != null && other.getType().equals(this.getType()) == false) return false; if (other.getMembers() == null ^ this.getMembers() == null) return false; if (other.getMembers() != null && other.getMembers().equals(this.getMembers()) == false) return false; if (other.getChannelArn() == null ^ this.getChannelArn() == null) return false; if (other.getChannelArn() != null && other.getChannelArn().equals(this.getChannelArn()) == false) return false; if (other.getSubChannelId() == null ^ this.getSubChannelId() == null) return false; if (other.getSubChannelId() != null && other.getSubChannelId().equals(this.getSubChannelId()) == false) return false; return true; } }