
com.amazonaws.services.gamelift.model.GameSessionConnectionInfo Maven / Gradle / Ivy
/*
* Copyright 2012-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.gamelift.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* Connection information for the new game session that is created with matchmaking. (with StartMatchmaking).
* Once a match is set, the FlexMatch engine places the match and creates a new game session for it. This information,
* including the game session endpoint and player sessions for each player in the original matchmaking request, is added
* to the MatchmakingTicket, which can be retrieved by calling DescribeMatchmaking.
*
*
* @see AWS
* API Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class GameSessionConnectionInfo implements Serializable, Cloneable, StructuredPojo {
/**
*
* Amazon Resource Name (ARN) that
* is assigned to a game session and uniquely identifies it.
*
*/
private String gameSessionArn;
/**
*
* IP address of the game session. To connect to a Amazon GameLift game server, an app needs both the IP address and
* port number.
*
*/
private String ipAddress;
/**
*
* Port number for the game session. To connect to a Amazon GameLift game server, an app needs both the IP address
* and port number.
*
*/
private Integer port;
/**
*
* Collection of player session IDs, one for each player ID that was included in the original matchmaking request.
*
*/
private java.util.List matchedPlayerSessions;
/**
*
* Amazon Resource Name (ARN) that
* is assigned to a game session and uniquely identifies it.
*
*
* @param gameSessionArn
* Amazon Resource Name (ARN)
* that is assigned to a game session and uniquely identifies it.
*/
public void setGameSessionArn(String gameSessionArn) {
this.gameSessionArn = gameSessionArn;
}
/**
*
* Amazon Resource Name (ARN) that
* is assigned to a game session and uniquely identifies it.
*
*
* @return Amazon Resource Name (ARN) that is assigned to a
* game session and uniquely identifies it.
*/
public String getGameSessionArn() {
return this.gameSessionArn;
}
/**
*
* Amazon Resource Name (ARN) that
* is assigned to a game session and uniquely identifies it.
*
*
* @param gameSessionArn
* Amazon Resource Name (ARN)
* that is assigned to a game session and uniquely identifies it.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public GameSessionConnectionInfo withGameSessionArn(String gameSessionArn) {
setGameSessionArn(gameSessionArn);
return this;
}
/**
*
* IP address of the game session. To connect to a Amazon GameLift game server, an app needs both the IP address and
* port number.
*
*
* @param ipAddress
* IP address of the game session. To connect to a Amazon GameLift game server, an app needs both the IP
* address and port number.
*/
public void setIpAddress(String ipAddress) {
this.ipAddress = ipAddress;
}
/**
*
* IP address of the game session. To connect to a Amazon GameLift game server, an app needs both the IP address and
* port number.
*
*
* @return IP address of the game session. To connect to a Amazon GameLift game server, an app needs both the IP
* address and port number.
*/
public String getIpAddress() {
return this.ipAddress;
}
/**
*
* IP address of the game session. To connect to a Amazon GameLift game server, an app needs both the IP address and
* port number.
*
*
* @param ipAddress
* IP address of the game session. To connect to a Amazon GameLift game server, an app needs both the IP
* address and port number.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public GameSessionConnectionInfo withIpAddress(String ipAddress) {
setIpAddress(ipAddress);
return this;
}
/**
*
* Port number for the game session. To connect to a Amazon GameLift game server, an app needs both the IP address
* and port number.
*
*
* @param port
* Port number for the game session. To connect to a Amazon GameLift game server, an app needs both the IP
* address and port number.
*/
public void setPort(Integer port) {
this.port = port;
}
/**
*
* Port number for the game session. To connect to a Amazon GameLift game server, an app needs both the IP address
* and port number.
*
*
* @return Port number for the game session. To connect to a Amazon GameLift game server, an app needs both the IP
* address and port number.
*/
public Integer getPort() {
return this.port;
}
/**
*
* Port number for the game session. To connect to a Amazon GameLift game server, an app needs both the IP address
* and port number.
*
*
* @param port
* Port number for the game session. To connect to a Amazon GameLift game server, an app needs both the IP
* address and port number.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public GameSessionConnectionInfo withPort(Integer port) {
setPort(port);
return this;
}
/**
*
* Collection of player session IDs, one for each player ID that was included in the original matchmaking request.
*
*
* @return Collection of player session IDs, one for each player ID that was included in the original matchmaking
* request.
*/
public java.util.List getMatchedPlayerSessions() {
return matchedPlayerSessions;
}
/**
*
* Collection of player session IDs, one for each player ID that was included in the original matchmaking request.
*
*
* @param matchedPlayerSessions
* Collection of player session IDs, one for each player ID that was included in the original matchmaking
* request.
*/
public void setMatchedPlayerSessions(java.util.Collection matchedPlayerSessions) {
if (matchedPlayerSessions == null) {
this.matchedPlayerSessions = null;
return;
}
this.matchedPlayerSessions = new java.util.ArrayList(matchedPlayerSessions);
}
/**
*
* Collection of player session IDs, one for each player ID that was included in the original matchmaking request.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setMatchedPlayerSessions(java.util.Collection)} or
* {@link #withMatchedPlayerSessions(java.util.Collection)} if you want to override the existing values.
*
*
* @param matchedPlayerSessions
* Collection of player session IDs, one for each player ID that was included in the original matchmaking
* request.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public GameSessionConnectionInfo withMatchedPlayerSessions(MatchedPlayerSession... matchedPlayerSessions) {
if (this.matchedPlayerSessions == null) {
setMatchedPlayerSessions(new java.util.ArrayList(matchedPlayerSessions.length));
}
for (MatchedPlayerSession ele : matchedPlayerSessions) {
this.matchedPlayerSessions.add(ele);
}
return this;
}
/**
*
* Collection of player session IDs, one for each player ID that was included in the original matchmaking request.
*
*
* @param matchedPlayerSessions
* Collection of player session IDs, one for each player ID that was included in the original matchmaking
* request.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public GameSessionConnectionInfo withMatchedPlayerSessions(java.util.Collection matchedPlayerSessions) {
setMatchedPlayerSessions(matchedPlayerSessions);
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 (getGameSessionArn() != null)
sb.append("GameSessionArn: ").append(getGameSessionArn()).append(",");
if (getIpAddress() != null)
sb.append("IpAddress: ").append(getIpAddress()).append(",");
if (getPort() != null)
sb.append("Port: ").append(getPort()).append(",");
if (getMatchedPlayerSessions() != null)
sb.append("MatchedPlayerSessions: ").append(getMatchedPlayerSessions());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof GameSessionConnectionInfo == false)
return false;
GameSessionConnectionInfo other = (GameSessionConnectionInfo) obj;
if (other.getGameSessionArn() == null ^ this.getGameSessionArn() == null)
return false;
if (other.getGameSessionArn() != null && other.getGameSessionArn().equals(this.getGameSessionArn()) == false)
return false;
if (other.getIpAddress() == null ^ this.getIpAddress() == null)
return false;
if (other.getIpAddress() != null && other.getIpAddress().equals(this.getIpAddress()) == false)
return false;
if (other.getPort() == null ^ this.getPort() == null)
return false;
if (other.getPort() != null && other.getPort().equals(this.getPort()) == false)
return false;
if (other.getMatchedPlayerSessions() == null ^ this.getMatchedPlayerSessions() == null)
return false;
if (other.getMatchedPlayerSessions() != null && other.getMatchedPlayerSessions().equals(this.getMatchedPlayerSessions()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getGameSessionArn() == null) ? 0 : getGameSessionArn().hashCode());
hashCode = prime * hashCode + ((getIpAddress() == null) ? 0 : getIpAddress().hashCode());
hashCode = prime * hashCode + ((getPort() == null) ? 0 : getPort().hashCode());
hashCode = prime * hashCode + ((getMatchedPlayerSessions() == null) ? 0 : getMatchedPlayerSessions().hashCode());
return hashCode;
}
@Override
public GameSessionConnectionInfo clone() {
try {
return (GameSessionConnectionInfo) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
@com.amazonaws.annotation.SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
com.amazonaws.services.gamelift.model.transform.GameSessionConnectionInfoMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}