Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2010-2015 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.elasticmapreduce.model;
 

Represents an EC2 instance provisioned as part of cluster.

 
 public class Instance implements SerializableCloneable {

    
The unique identifier for the instance in Amazon EMR.
 
     private String id;

    
The unique identifier of the instance in Amazon EC2.
 
     private String ec2InstanceId;

    
The public DNS name of the instance.
 
     private String publicDnsName;

    
The public IP address of the instance.
 
     private String publicIpAddress;

    
The private DNS name of the instance.
 
     private String privateDnsName;

    
The private IP address of the instance.
 
     private String privateIpAddress;

    
The current status of the instance.
 
     private InstanceStatus status;

    
The unique identifier for the instance in Amazon EMR.

Returns:
The unique identifier for the instance in Amazon EMR.
 
     public String getId() {
         return ;
     }
    
    
The unique identifier for the instance in Amazon EMR.

Parameters:
id The unique identifier for the instance in Amazon EMR.
 
     public void setId(String id) {
         this. = id;
     }
    
    
The unique identifier for the instance in Amazon EMR.

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

Parameters:
id The unique identifier for the instance in Amazon EMR.
Returns:
A reference to this updated object so that method calls can be chained together.
 
     public Instance withId(String id) {
         this. = id;
         return this;
     }

    
The unique identifier of the instance in Amazon EC2.

Returns:
The unique identifier of the instance in Amazon EC2.
 
     public String getEc2InstanceId() {
        return ;
    }
    
    
The unique identifier of the instance in Amazon EC2.

Parameters:
ec2InstanceId The unique identifier of the instance in Amazon EC2.
    public void setEc2InstanceId(String ec2InstanceId) {
        this. = ec2InstanceId;
    }
    
    
The unique identifier of the instance in Amazon EC2.

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

Parameters:
ec2InstanceId The unique identifier of the instance in Amazon EC2.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Instance withEc2InstanceId(String ec2InstanceId) {
        this. = ec2InstanceId;
        return this;
    }

    
The public DNS name of the instance.

Returns:
The public DNS name of the instance.
    public String getPublicDnsName() {
        return ;
    }
    
    
The public DNS name of the instance.

Parameters:
publicDnsName The public DNS name of the instance.
    public void setPublicDnsName(String publicDnsName) {
        this. = publicDnsName;
    }
    
    
The public DNS name of the instance.

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

Parameters:
publicDnsName The public DNS name of the instance.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Instance withPublicDnsName(String publicDnsName) {
        this. = publicDnsName;
        return this;
    }

    
The public IP address of the instance.

Returns:
The public IP address of the instance.
    public String getPublicIpAddress() {
        return ;
    }
    
    
The public IP address of the instance.

Parameters:
publicIpAddress The public IP address of the instance.
    public void setPublicIpAddress(String publicIpAddress) {
        this. = publicIpAddress;
    }
    
    
The public IP address of the instance.

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

Parameters:
publicIpAddress The public IP address of the instance.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Instance withPublicIpAddress(String publicIpAddress) {
        this. = publicIpAddress;
        return this;
    }

    
The private DNS name of the instance.

Returns:
The private DNS name of the instance.
    public String getPrivateDnsName() {
        return ;
    }
    
    
The private DNS name of the instance.

Parameters:
privateDnsName The private DNS name of the instance.
    public void setPrivateDnsName(String privateDnsName) {
        this. = privateDnsName;
    }
    
    
The private DNS name of the instance.

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

Parameters:
privateDnsName The private DNS name of the instance.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Instance withPrivateDnsName(String privateDnsName) {
        this. = privateDnsName;
        return this;
    }

    
The private IP address of the instance.

Returns:
The private IP address of the instance.
    public String getPrivateIpAddress() {
        return ;
    }
    
    
The private IP address of the instance.

Parameters:
privateIpAddress The private IP address of the instance.
    public void setPrivateIpAddress(String privateIpAddress) {
        this. = privateIpAddress;
    }
    
    
The private IP address of the instance.

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

Parameters:
privateIpAddress The private IP address of the instance.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Instance withPrivateIpAddress(String privateIpAddress) {
        this. = privateIpAddress;
        return this;
    }

    
The current status of the instance.

Returns:
The current status of the instance.
    public InstanceStatus getStatus() {
        return ;
    }
    
    
The current status of the instance.

Parameters:
status The current status of the instance.
    public void setStatus(InstanceStatus status) {
        this. = status;
    }
    
    
The current status of the instance.

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

Parameters:
status The current status of the instance.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Instance withStatus(InstanceStatus status) {
        this. = status;
        return this;
    }

    
Returns a string representation of this object; useful for testing and debugging.

Returns:
A string representation of this object.
See also:
java.lang.Object.toString()
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getId() != nullsb.append("Id: " + getId() + ",");
        if (getEc2InstanceId() != nullsb.append("Ec2InstanceId: " + getEc2InstanceId() + ",");
        if (getPublicDnsName() != nullsb.append("PublicDnsName: " + getPublicDnsName() + ",");
        if (getPublicIpAddress() != nullsb.append("PublicIpAddress: " + getPublicIpAddress() + ",");
        if (getPrivateDnsName() != nullsb.append("PrivateDnsName: " + getPrivateDnsName() + ",");
        if (getPrivateIpAddress() != nullsb.append("PrivateIpAddress: " + getPrivateIpAddress() + ",");
        if (getStatus() != nullsb.append("Status: " + getStatus() );
        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 + ((getEc2InstanceId() == null) ? 0 : getEc2InstanceId().hashCode()); 
        hashCode = prime * hashCode + ((getPublicDnsName() == null) ? 0 : getPublicDnsName().hashCode()); 
        hashCode = prime * hashCode + ((getPublicIpAddress() == null) ? 0 : getPublicIpAddress().hashCode()); 
        hashCode = prime * hashCode + ((getPrivateDnsName() == null) ? 0 : getPrivateDnsName().hashCode()); 
        hashCode = prime * hashCode + ((getPrivateIpAddress() == null) ? 0 : getPrivateIpAddress().hashCode()); 
        hashCode = prime * hashCode + ((getStatus() == null) ? 0 : getStatus().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof Instance == falsereturn false;
        Instance other = (Instance)obj;
        
        if (other.getId() == null ^ this.getId() == nullreturn false;
        if (other.getId() != null && other.getId().equals(this.getId()) == falsereturn false
        if (other.getEc2InstanceId() == null ^ this.getEc2InstanceId() == nullreturn false;
        if (other.getEc2InstanceId() != null && other.getEc2InstanceId().equals(this.getEc2InstanceId()) == falsereturn false
        if (other.getPublicDnsName() == null ^ this.getPublicDnsName() == nullreturn false;
        if (other.getPublicDnsName() != null && other.getPublicDnsName().equals(this.getPublicDnsName()) == falsereturn false
        if (other.getPublicIpAddress() == null ^ this.getPublicIpAddress() == nullreturn false;
        if (other.getPublicIpAddress() != null && other.getPublicIpAddress().equals(this.getPublicIpAddress()) == falsereturn false
        if (other.getPrivateDnsName() == null ^ this.getPrivateDnsName() == nullreturn false;
        if (other.getPrivateDnsName() != null && other.getPrivateDnsName().equals(this.getPrivateDnsName()) == falsereturn false
        if (other.getPrivateIpAddress() == null ^ this.getPrivateIpAddress() == nullreturn false;
        if (other.getPrivateIpAddress() != null && other.getPrivateIpAddress().equals(this.getPrivateIpAddress()) == falsereturn false
        if (other.getStatus() == null ^ this.getStatus() == nullreturn false;
        if (other.getStatus() != null && other.getStatus().equals(this.getStatus()) == falsereturn false
        return true;
    }
    
    @Override
    public Instance clone() {
        try {
            return (Instancesuper.clone();
        
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException(
                    "Got a CloneNotSupportedException from Object.clone() "
                    + "even though we're Cloneable!",
                    e);
        }
        
    }
}
    
New to GrepCode? Check out our FAQ X