com.amazonaws.services.location.model.GetDevicePositionResult Maven / Gradle / Ivy
Show all versions of aws-java-sdk-location Show documentation
/*
* Copyright 2019-2024 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.location.model;
import java.io.Serializable;
import javax.annotation.Generated;
/**
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class GetDevicePositionResult extends com.amazonaws.AmazonWebServiceResult implements Serializable, Cloneable {
/**
*
* The device whose position you retrieved.
*
*/
private String deviceId;
/**
*
* The timestamp at which the device's position was determined. Uses ISO 8601 format:
* YYYY-MM-DDThh:mm:ss.sssZ
.
*
*/
private java.util.Date sampleTime;
/**
*
* The timestamp for when the tracker resource received the device position. Uses ISO 8601 format:
* YYYY-MM-DDThh:mm:ss.sssZ
.
*
*/
private java.util.Date receivedTime;
/**
*
* The last known device position.
*
*/
private java.util.List position;
/**
*
* The accuracy of the device position.
*
*/
private PositionalAccuracy accuracy;
/**
*
* The properties associated with the position.
*
*/
private java.util.Map positionProperties;
/**
*
* The device whose position you retrieved.
*
*
* @param deviceId
* The device whose position you retrieved.
*/
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
/**
*
* The device whose position you retrieved.
*
*
* @return The device whose position you retrieved.
*/
public String getDeviceId() {
return this.deviceId;
}
/**
*
* The device whose position you retrieved.
*
*
* @param deviceId
* The device whose position you retrieved.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public GetDevicePositionResult withDeviceId(String deviceId) {
setDeviceId(deviceId);
return this;
}
/**
*
* The timestamp at which the device's position was determined. Uses ISO 8601 format:
* YYYY-MM-DDThh:mm:ss.sssZ
.
*
*
* @param sampleTime
* The timestamp at which the device's position was determined. Uses ISO 8601 format:
* YYYY-MM-DDThh:mm:ss.sssZ
.
*/
public void setSampleTime(java.util.Date sampleTime) {
this.sampleTime = sampleTime;
}
/**
*
* The timestamp at which the device's position was determined. Uses ISO 8601 format:
* YYYY-MM-DDThh:mm:ss.sssZ
.
*
*
* @return The timestamp at which the device's position was determined. Uses ISO 8601 format:
* YYYY-MM-DDThh:mm:ss.sssZ
.
*/
public java.util.Date getSampleTime() {
return this.sampleTime;
}
/**
*
* The timestamp at which the device's position was determined. Uses ISO 8601 format:
* YYYY-MM-DDThh:mm:ss.sssZ
.
*
*
* @param sampleTime
* The timestamp at which the device's position was determined. Uses ISO 8601 format:
* YYYY-MM-DDThh:mm:ss.sssZ
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public GetDevicePositionResult withSampleTime(java.util.Date sampleTime) {
setSampleTime(sampleTime);
return this;
}
/**
*
* The timestamp for when the tracker resource received the device position. Uses ISO 8601 format:
* YYYY-MM-DDThh:mm:ss.sssZ
.
*
*
* @param receivedTime
* The timestamp for when the tracker resource received the device position. Uses ISO 8601 format:
* YYYY-MM-DDThh:mm:ss.sssZ
.
*/
public void setReceivedTime(java.util.Date receivedTime) {
this.receivedTime = receivedTime;
}
/**
*
* The timestamp for when the tracker resource received the device position. Uses ISO 8601 format:
* YYYY-MM-DDThh:mm:ss.sssZ
.
*
*
* @return The timestamp for when the tracker resource received the device position. Uses ISO 8601 format:
* YYYY-MM-DDThh:mm:ss.sssZ
.
*/
public java.util.Date getReceivedTime() {
return this.receivedTime;
}
/**
*
* The timestamp for when the tracker resource received the device position. Uses ISO 8601 format:
* YYYY-MM-DDThh:mm:ss.sssZ
.
*
*
* @param receivedTime
* The timestamp for when the tracker resource received the device position. Uses ISO 8601 format:
* YYYY-MM-DDThh:mm:ss.sssZ
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public GetDevicePositionResult withReceivedTime(java.util.Date receivedTime) {
setReceivedTime(receivedTime);
return this;
}
/**
*
* The last known device position.
*
*
* @return The last known device position.
*/
public java.util.List getPosition() {
return position;
}
/**
*
* The last known device position.
*
*
* @param position
* The last known device position.
*/
public void setPosition(java.util.Collection position) {
if (position == null) {
this.position = null;
return;
}
this.position = new java.util.ArrayList(position);
}
/**
*
* The last known device position.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setPosition(java.util.Collection)} or {@link #withPosition(java.util.Collection)} if you want to override
* the existing values.
*
*
* @param position
* The last known device position.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public GetDevicePositionResult withPosition(Double... position) {
if (this.position == null) {
setPosition(new java.util.ArrayList(position.length));
}
for (Double ele : position) {
this.position.add(ele);
}
return this;
}
/**
*
* The last known device position.
*
*
* @param position
* The last known device position.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public GetDevicePositionResult withPosition(java.util.Collection position) {
setPosition(position);
return this;
}
/**
*
* The accuracy of the device position.
*
*
* @param accuracy
* The accuracy of the device position.
*/
public void setAccuracy(PositionalAccuracy accuracy) {
this.accuracy = accuracy;
}
/**
*
* The accuracy of the device position.
*
*
* @return The accuracy of the device position.
*/
public PositionalAccuracy getAccuracy() {
return this.accuracy;
}
/**
*
* The accuracy of the device position.
*
*
* @param accuracy
* The accuracy of the device position.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public GetDevicePositionResult withAccuracy(PositionalAccuracy accuracy) {
setAccuracy(accuracy);
return this;
}
/**
*
* The properties associated with the position.
*
*
* @return The properties associated with the position.
*/
public java.util.Map getPositionProperties() {
return positionProperties;
}
/**
*
* The properties associated with the position.
*
*
* @param positionProperties
* The properties associated with the position.
*/
public void setPositionProperties(java.util.Map positionProperties) {
this.positionProperties = positionProperties;
}
/**
*
* The properties associated with the position.
*
*
* @param positionProperties
* The properties associated with the position.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public GetDevicePositionResult withPositionProperties(java.util.Map positionProperties) {
setPositionProperties(positionProperties);
return this;
}
/**
* Add a single PositionProperties entry
*
* @see GetDevicePositionResult#withPositionProperties
* @returns a reference to this object so that method calls can be chained together.
*/
public GetDevicePositionResult addPositionPropertiesEntry(String key, String value) {
if (null == this.positionProperties) {
this.positionProperties = new java.util.HashMap();
}
if (this.positionProperties.containsKey(key))
throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided.");
this.positionProperties.put(key, value);
return this;
}
/**
* Removes all the entries added into PositionProperties.
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public GetDevicePositionResult clearPositionPropertiesEntries() {
this.positionProperties = null;
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 (getDeviceId() != null)
sb.append("DeviceId: ").append(getDeviceId()).append(",");
if (getSampleTime() != null)
sb.append("SampleTime: ").append(getSampleTime()).append(",");
if (getReceivedTime() != null)
sb.append("ReceivedTime: ").append(getReceivedTime()).append(",");
if (getPosition() != null)
sb.append("Position: ").append("***Sensitive Data Redacted***").append(",");
if (getAccuracy() != null)
sb.append("Accuracy: ").append(getAccuracy()).append(",");
if (getPositionProperties() != null)
sb.append("PositionProperties: ").append("***Sensitive Data Redacted***");
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof GetDevicePositionResult == false)
return false;
GetDevicePositionResult other = (GetDevicePositionResult) obj;
if (other.getDeviceId() == null ^ this.getDeviceId() == null)
return false;
if (other.getDeviceId() != null && other.getDeviceId().equals(this.getDeviceId()) == false)
return false;
if (other.getSampleTime() == null ^ this.getSampleTime() == null)
return false;
if (other.getSampleTime() != null && other.getSampleTime().equals(this.getSampleTime()) == false)
return false;
if (other.getReceivedTime() == null ^ this.getReceivedTime() == null)
return false;
if (other.getReceivedTime() != null && other.getReceivedTime().equals(this.getReceivedTime()) == false)
return false;
if (other.getPosition() == null ^ this.getPosition() == null)
return false;
if (other.getPosition() != null && other.getPosition().equals(this.getPosition()) == false)
return false;
if (other.getAccuracy() == null ^ this.getAccuracy() == null)
return false;
if (other.getAccuracy() != null && other.getAccuracy().equals(this.getAccuracy()) == false)
return false;
if (other.getPositionProperties() == null ^ this.getPositionProperties() == null)
return false;
if (other.getPositionProperties() != null && other.getPositionProperties().equals(this.getPositionProperties()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getDeviceId() == null) ? 0 : getDeviceId().hashCode());
hashCode = prime * hashCode + ((getSampleTime() == null) ? 0 : getSampleTime().hashCode());
hashCode = prime * hashCode + ((getReceivedTime() == null) ? 0 : getReceivedTime().hashCode());
hashCode = prime * hashCode + ((getPosition() == null) ? 0 : getPosition().hashCode());
hashCode = prime * hashCode + ((getAccuracy() == null) ? 0 : getAccuracy().hashCode());
hashCode = prime * hashCode + ((getPositionProperties() == null) ? 0 : getPositionProperties().hashCode());
return hashCode;
}
@Override
public GetDevicePositionResult clone() {
try {
return (GetDevicePositionResult) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
}