/* * 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 search index document. *

*/ public class ThingDocument implements Serializable { /** *

* The thing name. *

*

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

* The thing ID. *

*/ private String thingId; /** *

* The thing type name. *

*

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

* Thing group names. *

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

* The attributes. *

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

* The unnamed shadow and named shadow. *

*

* For more information about shadows, see IoT Device Shadow service. *

*/ private String shadow; /** *

* Contains Device Defender data. *

*

* For more information about Device Defender, see Device Defender. *

*/ private String deviceDefender; /** *

* Indicates whether the thing is connected to the Amazon Web Services IoT * Core service. *

*/ private ThingConnectivity connectivity; /** *

* The thing name. *

*

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

* The thing name. *

*/ public String getThingName() { return thingName; } /** *

* The thing name. *

*

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

* The thing name. *

*/ public void setThingName(String thingName) { this.thingName = thingName; } /** *

* The thing 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 thingName

* The thing name. *

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

* The thing ID. *

* * @return

* The thing ID. *

*/ public String getThingId() { return thingId; } /** *

* The thing ID. *

* * @param thingId

* The thing ID. *

*/ public void setThingId(String thingId) { this.thingId = thingId; } /** *

* The thing ID. *

*

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

* The thing ID. *

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

* The thing type name. *

*

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

* The thing type name. *

*/ public String getThingTypeName() { return thingTypeName; } /** *

* The thing type name. *

*

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

* The thing type name. *

*/ public void setThingTypeName(String thingTypeName) { this.thingTypeName = thingTypeName; } /** *

* The thing type 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 thingTypeName

* The thing type name. *

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

* Thing group names. *

* * @return

* Thing group names. *

*/ public java.util.List getThingGroupNames() { return thingGroupNames; } /** *

* Thing group names. *

* * @param thingGroupNames

* Thing group names. *

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

* Thing group names. *

*

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

* Thing group names. *

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

* Thing group names. *

*

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

* Thing group names. *

* @return A reference to this updated object so that method calls can be * chained together. */ public ThingDocument withThingGroupNames(java.util.Collection thingGroupNames) { setThingGroupNames(thingGroupNames); return this; } /** *

* The attributes. *

* * @return

* The attributes. *

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

* The attributes. *

* * @param attributes

* The attributes. *

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

* The attributes. *

*

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

* The attributes. *

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

* The 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 ThingDocument 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 ThingDocument clearattributesEntries() { this.attributes = null; return this; } /** *

* The unnamed shadow and named shadow. *

*

* For more information about shadows, see IoT Device Shadow service. *

* * @return

* The unnamed shadow and named shadow. *

*

* For more information about shadows, see IoT Device Shadow service. *

*/ public String getShadow() { return shadow; } /** *

* The unnamed shadow and named shadow. *

*

* For more information about shadows, see IoT Device Shadow service. *

* * @param shadow

* The unnamed shadow and named shadow. *

*

* For more information about shadows, see IoT Device Shadow service. *

*/ public void setShadow(String shadow) { this.shadow = shadow; } /** *

* The unnamed shadow and named shadow. *

*

* For more information about shadows, see IoT Device Shadow service. *

*

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

* The unnamed shadow and named shadow. *

*

* For more information about shadows, see IoT Device Shadow service. *

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

* Contains Device Defender data. *

*

* For more information about Device Defender, see Device Defender. *

* * @return

* Contains Device Defender data. *

*

* For more information about Device Defender, see Device Defender. *

*/ public String getDeviceDefender() { return deviceDefender; } /** *

* Contains Device Defender data. *

*

* For more information about Device Defender, see Device Defender. *

* * @param deviceDefender

* Contains Device Defender data. *

*

* For more information about Device Defender, see Device Defender. *

*/ public void setDeviceDefender(String deviceDefender) { this.deviceDefender = deviceDefender; } /** *

* Contains Device Defender data. *

*

* For more information about Device Defender, see Device Defender. *

*

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

* Contains Device Defender data. *

*

* For more information about Device Defender, see Device Defender. *

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

* Indicates whether the thing is connected to the Amazon Web Services IoT * Core service. *

* * @return

* Indicates whether the thing is connected to the Amazon Web * Services IoT Core service. *

*/ public ThingConnectivity getConnectivity() { return connectivity; } /** *

* Indicates whether the thing is connected to the Amazon Web Services IoT * Core service. *

* * @param connectivity

* Indicates whether the thing is connected to the Amazon Web * Services IoT Core service. *

*/ public void setConnectivity(ThingConnectivity connectivity) { this.connectivity = connectivity; } /** *

* Indicates whether the thing is connected to the Amazon Web Services IoT * Core service. *

*

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

* Indicates whether the thing is connected to the Amazon Web * Services IoT Core service. *

* @return A reference to this updated object so that method calls can be * chained together. */ public ThingDocument withConnectivity(ThingConnectivity connectivity) { this.connectivity = connectivity; 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 (getThingName() != null) sb.append("thingName: " + getThingName() + ","); if (getThingId() != null) sb.append("thingId: " + getThingId() + ","); if (getThingTypeName() != null) sb.append("thingTypeName: " + getThingTypeName() + ","); if (getThingGroupNames() != null) sb.append("thingGroupNames: " + getThingGroupNames() + ","); if (getAttributes() != null) sb.append("attributes: " + getAttributes() + ","); if (getShadow() != null) sb.append("shadow: " + getShadow() + ","); if (getDeviceDefender() != null) sb.append("deviceDefender: " + getDeviceDefender() + ","); if (getConnectivity() != null) sb.append("connectivity: " + getConnectivity()); sb.append("}"); return sb.toString(); } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getThingName() == null) ? 0 : getThingName().hashCode()); hashCode = prime * hashCode + ((getThingId() == null) ? 0 : getThingId().hashCode()); hashCode = prime * hashCode + ((getThingTypeName() == null) ? 0 : getThingTypeName().hashCode()); hashCode = prime * hashCode + ((getThingGroupNames() == null) ? 0 : getThingGroupNames().hashCode()); hashCode = prime * hashCode + ((getAttributes() == null) ? 0 : getAttributes().hashCode()); hashCode = prime * hashCode + ((getShadow() == null) ? 0 : getShadow().hashCode()); hashCode = prime * hashCode + ((getDeviceDefender() == null) ? 0 : getDeviceDefender().hashCode()); hashCode = prime * hashCode + ((getConnectivity() == null) ? 0 : getConnectivity().hashCode()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof ThingDocument == false) return false; ThingDocument other = (ThingDocument) obj; if (other.getThingName() == null ^ this.getThingName() == null) return false; if (other.getThingName() != null && other.getThingName().equals(this.getThingName()) == false) return false; if (other.getThingId() == null ^ this.getThingId() == null) return false; if (other.getThingId() != null && other.getThingId().equals(this.getThingId()) == false) return false; if (other.getThingTypeName() == null ^ this.getThingTypeName() == null) return false; if (other.getThingTypeName() != null && other.getThingTypeName().equals(this.getThingTypeName()) == false) return false; if (other.getThingGroupNames() == null ^ this.getThingGroupNames() == null) return false; if (other.getThingGroupNames() != null && other.getThingGroupNames().equals(this.getThingGroupNames()) == 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.getShadow() == null ^ this.getShadow() == null) return false; if (other.getShadow() != null && other.getShadow().equals(this.getShadow()) == false) return false; if (other.getDeviceDefender() == null ^ this.getDeviceDefender() == null) return false; if (other.getDeviceDefender() != null && other.getDeviceDefender().equals(this.getDeviceDefender()) == false) return false; if (other.getConnectivity() == null ^ this.getConnectivity() == null) return false; if (other.getConnectivity() != null && other.getConnectivity().equals(this.getConnectivity()) == false) return false; return true; } }