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.opsworks.model;
 

Describes an Elastic IP address.

 
 public class ElasticIp implements SerializableCloneable {

    
The IP address.
 
     private String ip;

    
The name.
 
     private String name;

    
The domain.
 
     private String domain;

    
The AWS region. For more information, see Regions and Endpoints.
 
     private String region;

    
The ID of the instance that the address is attached to.
 
     private String instanceId;

    
The IP address.

Returns:
The IP address.
 
     public String getIp() {
         return ;
     }
    
    
The IP address.

Parameters:
ip The IP address.
 
     public void setIp(String ip) {
         this. = ip;
     }
    
    
The IP address.

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

Parameters:
ip The IP address.
Returns:
A reference to this updated object so that method calls can be chained together.
 
     public ElasticIp withIp(String ip) {
         this. = ip;
         return this;
     }

    
The name.

Returns:
The name.
 
     public String getName() {
         return ;
     }
    
    
The name.

Parameters:
name The name.
 
    public void setName(String name) {
        this. = name;
    }
    
    
The name.

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

Parameters:
name The name.
Returns:
A reference to this updated object so that method calls can be chained together.
    public ElasticIp withName(String name) {
        this. = name;
        return this;
    }

    
The domain.

Returns:
The domain.
    public String getDomain() {
        return ;
    }
    
    
The domain.

Parameters:
domain The domain.
    public void setDomain(String domain) {
        this. = domain;
    }
    
    
The domain.

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

Parameters:
domain The domain.
Returns:
A reference to this updated object so that method calls can be chained together.
    public ElasticIp withDomain(String domain) {
        this. = domain;
        return this;
    }

    
The AWS region. For more information, see Regions and Endpoints.

Returns:
The AWS region. For more information, see Regions and Endpoints.
    public String getRegion() {
        return ;
    }
    
    
The AWS region. For more information, see Regions and Endpoints.

Parameters:
region The AWS region. For more information, see Regions and Endpoints.
    public void setRegion(String region) {
        this. = region;
    }
    
    
The AWS region. For more information, see Regions and Endpoints.

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

Parameters:
region The AWS region. For more information, see Regions and Endpoints.
Returns:
A reference to this updated object so that method calls can be chained together.
    public ElasticIp withRegion(String region) {
        this. = region;
        return this;
    }

    
The ID of the instance that the address is attached to.

Returns:
The ID of the instance that the address is attached to.
    public String getInstanceId() {
        return ;
    }
    
    
The ID of the instance that the address is attached to.

Parameters:
instanceId The ID of the instance that the address is attached to.
    public void setInstanceId(String instanceId) {
        this. = instanceId;
    }
    
    
The ID of the instance that the address is attached to.

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

Parameters:
instanceId The ID of the instance that the address is attached to.
Returns:
A reference to this updated object so that method calls can be chained together.
    public ElasticIp withInstanceId(String instanceId) {
        this. = instanceId;
        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 (getIp() != nullsb.append("Ip: " + getIp() + ",");
        if (getName() != nullsb.append("Name: " + getName() + ",");
        if (getDomain() != nullsb.append("Domain: " + getDomain() + ",");
        if (getRegion() != nullsb.append("Region: " + getRegion() + ",");
        if (getInstanceId() != nullsb.append("InstanceId: " + getInstanceId() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getIp() == null) ? 0 : getIp().hashCode()); 
        hashCode = prime * hashCode + ((getName() == null) ? 0 : getName().hashCode()); 
        hashCode = prime * hashCode + ((getDomain() == null) ? 0 : getDomain().hashCode()); 
        hashCode = prime * hashCode + ((getRegion() == null) ? 0 : getRegion().hashCode()); 
        hashCode = prime * hashCode + ((getInstanceId() == null) ? 0 : getInstanceId().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof ElasticIp == falsereturn false;
        ElasticIp other = (ElasticIp)obj;
        
        if (other.getIp() == null ^ this.getIp() == nullreturn false;
        if (other.getIp() != null && other.getIp().equals(this.getIp()) == falsereturn false
        if (other.getName() == null ^ this.getName() == nullreturn false;
        if (other.getName() != null && other.getName().equals(this.getName()) == falsereturn false
        if (other.getDomain() == null ^ this.getDomain() == nullreturn false;
        if (other.getDomain() != null && other.getDomain().equals(this.getDomain()) == falsereturn false
        if (other.getRegion() == null ^ this.getRegion() == nullreturn false;
        if (other.getRegion() != null && other.getRegion().equals(this.getRegion()) == falsereturn false
        if (other.getInstanceId() == null ^ this.getInstanceId() == nullreturn false;
        if (other.getInstanceId() != null && other.getInstanceId().equals(this.getInstanceId()) == falsereturn false
        return true;
    }
    
    @Override
    public ElasticIp clone() {
        try {
            return (ElasticIpsuper.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