com.amazonaws.services.pinpointanalytics.model.Session 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.pinpointanalytics.model;
import java.io.Serializable;
/**
*
* Describes the session. Session information is required on ALL events.
*
*/
public class Session implements Serializable {
/**
*
* A unique identifier for the session
*
*
* Constraints:
* Length: 1 - 50
*/
private String id;
/**
*
* The duration of the session.
*
*/
private Long duration;
/**
*
* The time the event started in ISO 8601 standard date time format. For
* example, 2014-06-30T19:07:47.885Z
*
*/
private String startTimestamp;
/**
*
* The time the event terminated in ISO 8601 standard date time format. For
* example, 2014-06-30T19:07:47.885Z
*
*/
private String stopTimestamp;
/**
*
* A unique identifier for the session
*
*
* Constraints:
* Length: 1 - 50
*
* @return
* A unique identifier for the session
*
*/
public String getId() {
return id;
}
/**
*
* A unique identifier for the session
*
*
* Constraints:
* Length: 1 - 50
*
* @param id
* A unique identifier for the session
*
*/
public void setId(String id) {
this.id = id;
}
/**
*
* A unique identifier for the session
*
*
* Returns a reference to this object so that method calls can be chained
* together.
*
* Constraints:
* Length: 1 - 50
*
* @param id
* A unique identifier for the session
*
* @return A reference to this updated object so that method calls can be
* chained together.
*/
public Session withId(String id) {
this.id = id;
return this;
}
/**
*
* The duration of the session.
*
*
* @return
* The duration of the session.
*
*/
public Long getDuration() {
return duration;
}
/**
*
* The duration of the session.
*
*
* @param duration
* The duration of the session.
*
*/
public void setDuration(Long duration) {
this.duration = duration;
}
/**
*
* The duration of the session.
*
*
* Returns a reference to this object so that method calls can be chained
* together.
*
* @param duration
* The duration of the session.
*
* @return A reference to this updated object so that method calls can be
* chained together.
*/
public Session withDuration(Long duration) {
this.duration = duration;
return this;
}
/**
*
* The time the event started in ISO 8601 standard date time format. For
* example, 2014-06-30T19:07:47.885Z
*
*
* @return
* The time the event started in ISO 8601 standard date time format.
* For example, 2014-06-30T19:07:47.885Z
*
*/
public String getStartTimestamp() {
return startTimestamp;
}
/**
*
* The time the event started in ISO 8601 standard date time format. For
* example, 2014-06-30T19:07:47.885Z
*
*
* @param startTimestamp
* The time the event started in ISO 8601 standard date time
* format. For example, 2014-06-30T19:07:47.885Z
*
*/
public void setStartTimestamp(String startTimestamp) {
this.startTimestamp = startTimestamp;
}
/**
*
* The time the event started in ISO 8601 standard date time format. For
* example, 2014-06-30T19:07:47.885Z
*
*
* Returns a reference to this object so that method calls can be chained
* together.
*
* @param startTimestamp
* The time the event started in ISO 8601 standard date time
* format. For example, 2014-06-30T19:07:47.885Z
*
* @return A reference to this updated object so that method calls can be
* chained together.
*/
public Session withStartTimestamp(String startTimestamp) {
this.startTimestamp = startTimestamp;
return this;
}
/**
*
* The time the event terminated in ISO 8601 standard date time format. For
* example, 2014-06-30T19:07:47.885Z
*
*
* @return
* The time the event terminated in ISO 8601 standard date time
* format. For example, 2014-06-30T19:07:47.885Z
*
*/
public String getStopTimestamp() {
return stopTimestamp;
}
/**
*
* The time the event terminated in ISO 8601 standard date time format. For
* example, 2014-06-30T19:07:47.885Z
*
*
* @param stopTimestamp
* The time the event terminated in ISO 8601 standard date time
* format. For example, 2014-06-30T19:07:47.885Z
*
*/
public void setStopTimestamp(String stopTimestamp) {
this.stopTimestamp = stopTimestamp;
}
/**
*
* The time the event terminated in ISO 8601 standard date time format. For
* example, 2014-06-30T19:07:47.885Z
*
*
* Returns a reference to this object so that method calls can be chained
* together.
*
* @param stopTimestamp
* The time the event terminated in ISO 8601 standard date time
* format. For example, 2014-06-30T19:07:47.885Z
*
* @return A reference to this updated object so that method calls can be
* chained together.
*/
public Session withStopTimestamp(String stopTimestamp) {
this.stopTimestamp = stopTimestamp;
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 (getId() != null)
sb.append("id: " + getId() + ",");
if (getDuration() != null)
sb.append("duration: " + getDuration() + ",");
if (getStartTimestamp() != null)
sb.append("startTimestamp: " + getStartTimestamp() + ",");
if (getStopTimestamp() != null)
sb.append("stopTimestamp: " + getStopTimestamp());
sb.append("}");
return sb.toString();
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getId() == null) ? 0 : getId().hashCode());
hashCode = prime * hashCode + ((getDuration() == null) ? 0 : getDuration().hashCode());
hashCode = prime * hashCode
+ ((getStartTimestamp() == null) ? 0 : getStartTimestamp().hashCode());
hashCode = prime * hashCode
+ ((getStopTimestamp() == null) ? 0 : getStopTimestamp().hashCode());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof Session == false)
return false;
Session other = (Session) obj;
if (other.getId() == null ^ this.getId() == null)
return false;
if (other.getId() != null && other.getId().equals(this.getId()) == false)
return false;
if (other.getDuration() == null ^ this.getDuration() == null)
return false;
if (other.getDuration() != null && other.getDuration().equals(this.getDuration()) == false)
return false;
if (other.getStartTimestamp() == null ^ this.getStartTimestamp() == null)
return false;
if (other.getStartTimestamp() != null
&& other.getStartTimestamp().equals(this.getStartTimestamp()) == false)
return false;
if (other.getStopTimestamp() == null ^ this.getStopTimestamp() == null)
return false;
if (other.getStopTimestamp() != null
&& other.getStopTimestamp().equals(this.getStopTimestamp()) == false)
return false;
return true;
}
}