com.amazonaws.services.iot.model.ThingDocument Maven / Gradle / Ivy
/*
* Copyright 2010-2018 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 shadow.
*
*/
private String shadow;
/**
*
* 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 shadow.
*
*
* @return
* The shadow.
*
*/
public String getShadow() {
return shadow;
}
/**
*
* The shadow.
*
*
* @param shadow
* The shadow.
*
*/
public void setShadow(String shadow) {
this.shadow = shadow;
}
/**
*
* The shadow.
*
*
* Returns a reference to this object so that method calls can be chained
* together.
*
* @param shadow
* The shadow.
*
* @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;
}
/**
* 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());
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());
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;
return true;
}
}