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

* Contains the device position details. *

*/ public class DevicePosition implements Serializable { /** *

* The accuracy of the device position. *

*/ private PositionalAccuracy accuracy; /** *

* The device whose position you retrieved. *

*

* Constraints:
* Length: 1 - 100
* Pattern: ^[-._\p{L}\p{N}]+$
*/ private String deviceId; /** *

* The last known device position. *

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

* The properties associated with the position. *

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

* The timestamp for when the tracker resource received the device position * in ISO * 8601 format: YYYY-MM-DDThh:mm:ss.sssZ. *

*/ private java.util.Date receivedTime; /** *

* 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 accuracy of the device position. *

* * @return

* The accuracy of the device position. *

*/ public PositionalAccuracy getAccuracy() { return accuracy; } /** *

* 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. *

*

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

* The accuracy of the device position. *

* @return A reference to this updated object so that method calls can be * chained together. */ public DevicePosition withAccuracy(PositionalAccuracy accuracy) { this.accuracy = accuracy; return this; } /** *

* The device whose position you retrieved. *

*

* Constraints:
* Length: 1 - 100
* Pattern: ^[-._\p{L}\p{N}]+$
* * @return

* The device whose position you retrieved. *

*/ public String getDeviceId() { return deviceId; } /** *

* The device whose position you retrieved. *

*

* Constraints:
* Length: 1 - 100
* Pattern: ^[-._\p{L}\p{N}]+$
* * @param deviceId

* The device whose position you retrieved. *

*/ public void setDeviceId(String deviceId) { this.deviceId = deviceId; } /** *

* The device whose position you retrieved. *

*

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

* Constraints:
* Length: 1 - 100
* Pattern: ^[-._\p{L}\p{N}]+$
* * @param deviceId

* The device whose position you retrieved. *

* @return A reference to this updated object so that method calls can be * chained together. */ public DevicePosition withDeviceId(String deviceId) { this.deviceId = deviceId; 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. *

*

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

* The last known device position. *

* @return A reference to this updated object so that method calls can be * chained together. */ public DevicePosition withPosition(Double... position) { if (getPosition() == null) { this.position = new java.util.ArrayList(position.length); } for (Double value : position) { this.position.add(value); } return this; } /** *

* The last known device position. *

*

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

* The last known device position. *

* @return A reference to this updated object so that method calls can be * chained together. */ public DevicePosition withPosition(java.util.Collection position) { setPosition(position); 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. *

*

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

* The properties associated with the position. *

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

* The properties associated with the position. *

*

* The method adds a new key-value pair into PositionProperties 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 PositionProperties. * @param value The corresponding value of the entry to be added into * PositionProperties. * @return A reference to this updated object so that method calls can be * chained together. */ public DevicePosition 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. *

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

* The timestamp for when the tracker resource received the device position * in ISO * 8601 format: YYYY-MM-DDThh:mm:ss.sssZ. *

* * @return

* The timestamp for when the tracker resource received the device * position in * ISO 8601 format: YYYY-MM-DDThh:mm:ss.sssZ. *

*/ public java.util.Date getReceivedTime() { return receivedTime; } /** *

* The timestamp for when the tracker resource received the device position * in ISO * 8601 format: YYYY-MM-DDThh:mm:ss.sssZ. *

* * @param receivedTime

* The timestamp for when the tracker resource received the * device position in 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 * in ISO * 8601 format: YYYY-MM-DDThh:mm:ss.sssZ. *

*

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

* The timestamp for when the tracker resource received the * device position in ISO * 8601 format: YYYY-MM-DDThh:mm:ss.sssZ. *

* @return A reference to this updated object so that method calls can be * chained together. */ public DevicePosition withReceivedTime(java.util.Date receivedTime) { this.receivedTime = receivedTime; return this; } /** *

* 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 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. *

*/ 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. *

*

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

* The timestamp at which the device's position was determined. * Uses ISO * 8601 format: YYYY-MM-DDThh:mm:ss.sssZ. *

* @return A reference to this updated object so that method calls can be * chained together. */ public DevicePosition withSampleTime(java.util.Date sampleTime) { this.sampleTime = sampleTime; 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 (getAccuracy() != null) sb.append("Accuracy: " + getAccuracy() + ","); if (getDeviceId() != null) sb.append("DeviceId: " + getDeviceId() + ","); if (getPosition() != null) sb.append("Position: " + getPosition() + ","); if (getPositionProperties() != null) sb.append("PositionProperties: " + getPositionProperties() + ","); if (getReceivedTime() != null) sb.append("ReceivedTime: " + getReceivedTime() + ","); if (getSampleTime() != null) sb.append("SampleTime: " + getSampleTime()); sb.append("}"); return sb.toString(); } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getAccuracy() == null) ? 0 : getAccuracy().hashCode()); hashCode = prime * hashCode + ((getDeviceId() == null) ? 0 : getDeviceId().hashCode()); hashCode = prime * hashCode + ((getPosition() == null) ? 0 : getPosition().hashCode()); hashCode = prime * hashCode + ((getPositionProperties() == null) ? 0 : getPositionProperties().hashCode()); hashCode = prime * hashCode + ((getReceivedTime() == null) ? 0 : getReceivedTime().hashCode()); hashCode = prime * hashCode + ((getSampleTime() == null) ? 0 : getSampleTime().hashCode()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof DevicePosition == false) return false; DevicePosition other = (DevicePosition) obj; if (other.getAccuracy() == null ^ this.getAccuracy() == null) return false; if (other.getAccuracy() != null && other.getAccuracy().equals(this.getAccuracy()) == false) return false; if (other.getDeviceId() == null ^ this.getDeviceId() == null) return false; if (other.getDeviceId() != null && other.getDeviceId().equals(this.getDeviceId()) == 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.getPositionProperties() == null ^ this.getPositionProperties() == null) return false; if (other.getPositionProperties() != null && other.getPositionProperties().equals(this.getPositionProperties()) == 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.getSampleTime() == null ^ this.getSampleTime() == null) return false; if (other.getSampleTime() != null && other.getSampleTime().equals(this.getSampleTime()) == false) return false; return true; } }