
com.amazonaws.services.gamelift.model.Event Maven / Gradle / Ivy
Show all versions of aws-java-sdk-gamelift Show documentation
/*
* Copyright 2011-2016 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.gamelift.model;
import java.io.Serializable;
/**
*
* Log entry describing an event involving an Amazon GameLift resource (such as
* a fleet).
*
*/
public class Event implements Serializable, Cloneable {
/**
*
* Unique identifier for a fleet event.
*
*/
private String eventId;
/**
*
* Unique identifier for the resource, such as a fleet ID.
*
*/
private String resourceId;
/**
*
* Type of event being logged.
*
*/
private String eventCode;
/**
*
* Additional information related to the event.
*
*/
private String message;
/**
*
* Time stamp indicating when this event occurred. Format is a number
* expressed in Unix time as milliseconds (ex: "1469498468.057".
*
*/
private java.util.Date eventTime;
/**
*
* Unique identifier for a fleet event.
*
*
* @param eventId
* Unique identifier for a fleet event.
*/
public void setEventId(String eventId) {
this.eventId = eventId;
}
/**
*
* Unique identifier for a fleet event.
*
*
* @return Unique identifier for a fleet event.
*/
public String getEventId() {
return this.eventId;
}
/**
*
* Unique identifier for a fleet event.
*
*
* @param eventId
* Unique identifier for a fleet event.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public Event withEventId(String eventId) {
setEventId(eventId);
return this;
}
/**
*
* Unique identifier for the resource, such as a fleet ID.
*
*
* @param resourceId
* Unique identifier for the resource, such as a fleet ID.
*/
public void setResourceId(String resourceId) {
this.resourceId = resourceId;
}
/**
*
* Unique identifier for the resource, such as a fleet ID.
*
*
* @return Unique identifier for the resource, such as a fleet ID.
*/
public String getResourceId() {
return this.resourceId;
}
/**
*
* Unique identifier for the resource, such as a fleet ID.
*
*
* @param resourceId
* Unique identifier for the resource, such as a fleet ID.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public Event withResourceId(String resourceId) {
setResourceId(resourceId);
return this;
}
/**
*
* Type of event being logged.
*
*
* @param eventCode
* Type of event being logged.
* @see EventCode
*/
public void setEventCode(String eventCode) {
this.eventCode = eventCode;
}
/**
*
* Type of event being logged.
*
*
* @return Type of event being logged.
* @see EventCode
*/
public String getEventCode() {
return this.eventCode;
}
/**
*
* Type of event being logged.
*
*
* @param eventCode
* Type of event being logged.
* @return Returns a reference to this object so that method calls can be
* chained together.
* @see EventCode
*/
public Event withEventCode(String eventCode) {
setEventCode(eventCode);
return this;
}
/**
*
* Type of event being logged.
*
*
* @param eventCode
* Type of event being logged.
* @see EventCode
*/
public void setEventCode(EventCode eventCode) {
this.eventCode = eventCode.toString();
}
/**
*
* Type of event being logged.
*
*
* @param eventCode
* Type of event being logged.
* @return Returns a reference to this object so that method calls can be
* chained together.
* @see EventCode
*/
public Event withEventCode(EventCode eventCode) {
setEventCode(eventCode);
return this;
}
/**
*
* Additional information related to the event.
*
*
* @param message
* Additional information related to the event.
*/
public void setMessage(String message) {
this.message = message;
}
/**
*
* Additional information related to the event.
*
*
* @return Additional information related to the event.
*/
public String getMessage() {
return this.message;
}
/**
*
* Additional information related to the event.
*
*
* @param message
* Additional information related to the event.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public Event withMessage(String message) {
setMessage(message);
return this;
}
/**
*
* Time stamp indicating when this event occurred. Format is a number
* expressed in Unix time as milliseconds (ex: "1469498468.057".
*
*
* @param eventTime
* Time stamp indicating when this event occurred. Format is a number
* expressed in Unix time as milliseconds (ex: "1469498468.057".
*/
public void setEventTime(java.util.Date eventTime) {
this.eventTime = eventTime;
}
/**
*
* Time stamp indicating when this event occurred. Format is a number
* expressed in Unix time as milliseconds (ex: "1469498468.057".
*
*
* @return Time stamp indicating when this event occurred. Format is a
* number expressed in Unix time as milliseconds (ex:
* "1469498468.057".
*/
public java.util.Date getEventTime() {
return this.eventTime;
}
/**
*
* Time stamp indicating when this event occurred. Format is a number
* expressed in Unix time as milliseconds (ex: "1469498468.057".
*
*
* @param eventTime
* Time stamp indicating when this event occurred. Format is a number
* expressed in Unix time as milliseconds (ex: "1469498468.057".
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public Event withEventTime(java.util.Date eventTime) {
setEventTime(eventTime);
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 (getEventId() != null)
sb.append("EventId: " + getEventId() + ",");
if (getResourceId() != null)
sb.append("ResourceId: " + getResourceId() + ",");
if (getEventCode() != null)
sb.append("EventCode: " + getEventCode() + ",");
if (getMessage() != null)
sb.append("Message: " + getMessage() + ",");
if (getEventTime() != null)
sb.append("EventTime: " + getEventTime());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof Event == false)
return false;
Event other = (Event) obj;
if (other.getEventId() == null ^ this.getEventId() == null)
return false;
if (other.getEventId() != null
&& other.getEventId().equals(this.getEventId()) == false)
return false;
if (other.getResourceId() == null ^ this.getResourceId() == null)
return false;
if (other.getResourceId() != null
&& other.getResourceId().equals(this.getResourceId()) == false)
return false;
if (other.getEventCode() == null ^ this.getEventCode() == null)
return false;
if (other.getEventCode() != null
&& other.getEventCode().equals(this.getEventCode()) == false)
return false;
if (other.getMessage() == null ^ this.getMessage() == null)
return false;
if (other.getMessage() != null
&& other.getMessage().equals(this.getMessage()) == false)
return false;
if (other.getEventTime() == null ^ this.getEventTime() == null)
return false;
if (other.getEventTime() != null
&& other.getEventTime().equals(this.getEventTime()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode
+ ((getEventId() == null) ? 0 : getEventId().hashCode());
hashCode = prime * hashCode
+ ((getResourceId() == null) ? 0 : getResourceId().hashCode());
hashCode = prime * hashCode
+ ((getEventCode() == null) ? 0 : getEventCode().hashCode());
hashCode = prime * hashCode
+ ((getMessage() == null) ? 0 : getMessage().hashCode());
hashCode = prime * hashCode
+ ((getEventTime() == null) ? 0 : getEventTime().hashCode());
return hashCode;
}
@Override
public Event clone() {
try {
return (Event) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException(
"Got a CloneNotSupportedException from Object.clone() "
+ "even though we're Cloneable!", e);
}
}
}