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

* The thing group search index document. *

*/ public class ThingGroupDocument implements Serializable { /** *

* The thing group name. *

*

* Constraints:
* Length: 1 - 128
* Pattern: [a-zA-Z0-9:_-]+
*/ private String thingGroupName; /** *

* The thing group ID. *

*

* Constraints:
* Length: 1 - 128
* Pattern: [a-zA-Z0-9\-]+
*/ private String thingGroupId; /** *

* The thing group description. *

*

* Constraints:
* Length: - 2028
* Pattern: [\p{Graph}\x20]*
*/ private String thingGroupDescription; /** *

* The thing group attributes. *

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

* Parent group names. *

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

* The thing group name. *

*

* Constraints:
* Length: 1 - 128
* Pattern: [a-zA-Z0-9:_-]+
* * @return

* The thing group name. *

*/ public String getThingGroupName() { return thingGroupName; } /** *

* The thing group name. *

*

* Constraints:
* Length: 1 - 128
* Pattern: [a-zA-Z0-9:_-]+
* * @param thingGroupName

* The thing group name. *

*/ public void setThingGroupName(String thingGroupName) { this.thingGroupName = thingGroupName; } /** *

* The thing group name. *

*

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

* Constraints:
* Length: 1 - 128
* Pattern: [a-zA-Z0-9:_-]+
* * @param thingGroupName

* The thing group name. *

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

* The thing group ID. *

*

* Constraints:
* Length: 1 - 128
* Pattern: [a-zA-Z0-9\-]+
* * @return

* The thing group ID. *

*/ public String getThingGroupId() { return thingGroupId; } /** *

* The thing group ID. *

*

* Constraints:
* Length: 1 - 128
* Pattern: [a-zA-Z0-9\-]+
* * @param thingGroupId

* The thing group ID. *

*/ public void setThingGroupId(String thingGroupId) { this.thingGroupId = thingGroupId; } /** *

* The thing group ID. *

*

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

* Constraints:
* Length: 1 - 128
* Pattern: [a-zA-Z0-9\-]+
* * @param thingGroupId

* The thing group ID. *

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

* The thing group description. *

*

* Constraints:
* Length: - 2028
* Pattern: [\p{Graph}\x20]*
* * @return

* The thing group description. *

*/ public String getThingGroupDescription() { return thingGroupDescription; } /** *

* The thing group description. *

*

* Constraints:
* Length: - 2028
* Pattern: [\p{Graph}\x20]*
* * @param thingGroupDescription

* The thing group description. *

*/ public void setThingGroupDescription(String thingGroupDescription) { this.thingGroupDescription = thingGroupDescription; } /** *

* The thing group description. *

*

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

* Constraints:
* Length: - 2028
* Pattern: [\p{Graph}\x20]*
* * @param thingGroupDescription

* The thing group description. *

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

* The thing group attributes. *

* * @return

* The thing group attributes. *

*/ public java.util.Map getAttributes() { return attributes; } /** *

* The thing group attributes. *

* * @param attributes

* The thing group attributes. *

*/ public void setAttributes(java.util.Map attributes) { this.attributes = attributes; } /** *

* The thing group attributes. *

*

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

* The thing group attributes. *

* @return A reference to this updated object so that method calls can be * chained together. */ public ThingGroupDocument withAttributes(java.util.Map attributes) { this.attributes = attributes; return this; } /** *

* The thing group attributes. *

*

* The method adds a new key-value pair into attributes parameter, and * returns a reference to this object so that method calls can be chained * together. * * @param key The key of the entry to be added into attributes. * @param value The corresponding value of the entry to be added into * attributes. * @return A reference to this updated object so that method calls can be * chained together. */ public ThingGroupDocument addattributesEntry(String key, String value) { if (null == this.attributes) { this.attributes = new java.util.HashMap(); } if (this.attributes.containsKey(key)) throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided."); this.attributes.put(key, value); return this; } /** * Removes all the entries added into attributes. *

* Returns a reference to this object so that method calls can be chained * together. */ public ThingGroupDocument clearattributesEntries() { this.attributes = null; return this; } /** *

* Parent group names. *

* * @return

* Parent group names. *

*/ public java.util.List getParentGroupNames() { return parentGroupNames; } /** *

* Parent group names. *

* * @param parentGroupNames

* Parent group names. *

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

* Parent group names. *

*

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

* Parent group names. *

* @return A reference to this updated object so that method calls can be * chained together. */ public ThingGroupDocument withParentGroupNames(String... parentGroupNames) { if (getParentGroupNames() == null) { this.parentGroupNames = new java.util.ArrayList(parentGroupNames.length); } for (String value : parentGroupNames) { this.parentGroupNames.add(value); } return this; } /** *

* Parent group names. *

*

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

* Parent group names. *

* @return A reference to this updated object so that method calls can be * chained together. */ public ThingGroupDocument withParentGroupNames(java.util.Collection parentGroupNames) { setParentGroupNames(parentGroupNames); 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 (getThingGroupName() != null) sb.append("thingGroupName: " + getThingGroupName() + ","); if (getThingGroupId() != null) sb.append("thingGroupId: " + getThingGroupId() + ","); if (getThingGroupDescription() != null) sb.append("thingGroupDescription: " + getThingGroupDescription() + ","); if (getAttributes() != null) sb.append("attributes: " + getAttributes() + ","); if (getParentGroupNames() != null) sb.append("parentGroupNames: " + getParentGroupNames()); sb.append("}"); return sb.toString(); } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getThingGroupName() == null) ? 0 : getThingGroupName().hashCode()); hashCode = prime * hashCode + ((getThingGroupId() == null) ? 0 : getThingGroupId().hashCode()); hashCode = prime * hashCode + ((getThingGroupDescription() == null) ? 0 : getThingGroupDescription().hashCode()); hashCode = prime * hashCode + ((getAttributes() == null) ? 0 : getAttributes().hashCode()); hashCode = prime * hashCode + ((getParentGroupNames() == null) ? 0 : getParentGroupNames().hashCode()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof ThingGroupDocument == false) return false; ThingGroupDocument other = (ThingGroupDocument) obj; if (other.getThingGroupName() == null ^ this.getThingGroupName() == null) return false; if (other.getThingGroupName() != null && other.getThingGroupName().equals(this.getThingGroupName()) == false) return false; if (other.getThingGroupId() == null ^ this.getThingGroupId() == null) return false; if (other.getThingGroupId() != null && other.getThingGroupId().equals(this.getThingGroupId()) == false) return false; if (other.getThingGroupDescription() == null ^ this.getThingGroupDescription() == null) return false; if (other.getThingGroupDescription() != null && other.getThingGroupDescription().equals(this.getThingGroupDescription()) == false) return false; if (other.getAttributes() == null ^ this.getAttributes() == null) return false; if (other.getAttributes() != null && other.getAttributes().equals(this.getAttributes()) == false) return false; if (other.getParentGroupNames() == null ^ this.getParentGroupNames() == null) return false; if (other.getParentGroupNames() != null && other.getParentGroupNames().equals(this.getParentGroupNames()) == false) return false; return true; } }