
com.amazonaws.services.iot.model.ThingDocument Maven / Gradle / Ivy
/*
* Copyright 2015-2020 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;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* The thing search index document.
*
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class ThingDocument implements Serializable, Cloneable, StructuredPojo {
/**
*
* The thing name.
*
*/
private String thingName;
/**
*
* The thing ID.
*
*/
private String thingId;
/**
*
* The thing type name.
*
*/
private String thingTypeName;
/**
*
* Thing group names.
*
*/
private java.util.List thingGroupNames;
/**
*
* The attributes.
*
*/
private java.util.Map attributes;
/**
*
* The shadow.
*
*/
private String shadow;
/**
*
* Indicates whether the thing is connected to the AWS IoT service.
*
*/
private ThingConnectivity connectivity;
/**
*
* The thing name.
*
*
* @param thingName
* The thing name.
*/
public void setThingName(String thingName) {
this.thingName = thingName;
}
/**
*
* The thing name.
*
*
* @return The thing name.
*/
public String getThingName() {
return this.thingName;
}
/**
*
* The thing name.
*
*
* @param thingName
* The thing name.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ThingDocument withThingName(String thingName) {
setThingName(thingName);
return this;
}
/**
*
* The thing ID.
*
*
* @param thingId
* The thing ID.
*/
public void setThingId(String thingId) {
this.thingId = thingId;
}
/**
*
* The thing ID.
*
*
* @return The thing ID.
*/
public String getThingId() {
return this.thingId;
}
/**
*
* The thing ID.
*
*
* @param thingId
* The thing ID.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ThingDocument withThingId(String thingId) {
setThingId(thingId);
return this;
}
/**
*
* The thing type name.
*
*
* @param thingTypeName
* The thing type name.
*/
public void setThingTypeName(String thingTypeName) {
this.thingTypeName = thingTypeName;
}
/**
*
* The thing type name.
*
*
* @return The thing type name.
*/
public String getThingTypeName() {
return this.thingTypeName;
}
/**
*
* The thing type name.
*
*
* @param thingTypeName
* The thing type name.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ThingDocument withThingTypeName(String thingTypeName) {
setThingTypeName(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.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setThingGroupNames(java.util.Collection)} or {@link #withThingGroupNames(java.util.Collection)} if you
* want to override the existing values.
*
*
* @param thingGroupNames
* Thing group names.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ThingDocument withThingGroupNames(String... thingGroupNames) {
if (this.thingGroupNames == null) {
setThingGroupNames(new java.util.ArrayList(thingGroupNames.length));
}
for (String ele : thingGroupNames) {
this.thingGroupNames.add(ele);
}
return this;
}
/**
*
* Thing group names.
*
*
* @param thingGroupNames
* Thing group names.
* @return Returns a reference to this 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.
*
*
* @param attributes
* The attributes.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ThingDocument withAttributes(java.util.Map attributes) {
setAttributes(attributes);
return this;
}
/**
* Add a single Attributes entry
*
* @see ThingDocument#withAttributes
* @returns a reference to this 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.
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ThingDocument clearAttributesEntries() {
this.attributes = null;
return this;
}
/**
*
* The shadow.
*
*
* @param shadow
* The shadow.
*/
public void setShadow(String shadow) {
this.shadow = shadow;
}
/**
*
* The shadow.
*
*
* @return The shadow.
*/
public String getShadow() {
return this.shadow;
}
/**
*
* The shadow.
*
*
* @param shadow
* The shadow.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ThingDocument withShadow(String shadow) {
setShadow(shadow);
return this;
}
/**
*
* Indicates whether the thing is connected to the AWS IoT service.
*
*
* @param connectivity
* Indicates whether the thing is connected to the AWS IoT service.
*/
public void setConnectivity(ThingConnectivity connectivity) {
this.connectivity = connectivity;
}
/**
*
* Indicates whether the thing is connected to the AWS IoT service.
*
*
* @return Indicates whether the thing is connected to the AWS IoT service.
*/
public ThingConnectivity getConnectivity() {
return this.connectivity;
}
/**
*
* Indicates whether the thing is connected to the AWS IoT service.
*
*
* @param connectivity
* Indicates whether the thing is connected to the AWS IoT service.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ThingDocument withConnectivity(ThingConnectivity connectivity) {
setConnectivity(connectivity);
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 (getThingName() != null)
sb.append("ThingName: ").append(getThingName()).append(",");
if (getThingId() != null)
sb.append("ThingId: ").append(getThingId()).append(",");
if (getThingTypeName() != null)
sb.append("ThingTypeName: ").append(getThingTypeName()).append(",");
if (getThingGroupNames() != null)
sb.append("ThingGroupNames: ").append(getThingGroupNames()).append(",");
if (getAttributes() != null)
sb.append("Attributes: ").append(getAttributes()).append(",");
if (getShadow() != null)
sb.append("Shadow: ").append(getShadow()).append(",");
if (getConnectivity() != null)
sb.append("Connectivity: ").append(getConnectivity());
sb.append("}");
return sb.toString();
}
@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.getConnectivity() == null ^ this.getConnectivity() == null)
return false;
if (other.getConnectivity() != null && other.getConnectivity().equals(this.getConnectivity()) == false)
return false;
return true;
}
@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 + ((getConnectivity() == null) ? 0 : getConnectivity().hashCode());
return hashCode;
}
@Override
public ThingDocument clone() {
try {
return (ThingDocument) 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.iot.model.transform.ThingDocumentMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}