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

Describes an Elastic IP address.

 
 public class Address implements SerializableCloneable {

    
The ID of the instance the address is associated with (if any).
 
     private String instanceId;

    
The Elastic IP address.
 
     private String publicIp;

    
The ID representing the allocation of the address for use with EC2-VPC.
 
     private String allocationId;

    
The ID representing the association of the address with an instance in a VPC.
 
     private String associationId;

    
Indicates whether this Elastic IP address is for use with instances in EC2-Classic (standard) or instances in a VPC (vpc).

Constraints:
Allowed Values: vpc, standard

 
     private String domain;

    
The ID of the network interface.
 
     private String networkInterfaceId;

    
The ID of the AWS account that owns the network interface.
 
     private String networkInterfaceOwnerId;

    
The private IP address associated with the Elastic IP address.
 
     private String privateIpAddress;

    
The ID of the instance the address is associated with (if any).

Returns:
The ID of the instance the address is associated with (if any).
 
     public String getInstanceId() {
         return ;
     }
    
    
The ID of the instance the address is associated with (if any).

Parameters:
instanceId The ID of the instance the address is associated with (if any).
 
     public void setInstanceId(String instanceId) {
         this. = instanceId;
     }
    
    
The ID of the instance the address is associated with (if any).

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

Parameters:
instanceId The ID of the instance the address is associated with (if any).
Returns:
A reference to this updated object so that method calls can be chained together.
    public Address withInstanceId(String instanceId) {
        this. = instanceId;
        return this;
    }

    
The Elastic IP address.

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

Parameters:
publicIp The Elastic IP address.
    public void setPublicIp(String publicIp) {
        this. = publicIp;
    }
    
    
The Elastic IP address.

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

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

    
The ID representing the allocation of the address for use with EC2-VPC.

Returns:
The ID representing the allocation of the address for use with EC2-VPC.
    public String getAllocationId() {
        return ;
    }
    
    
The ID representing the allocation of the address for use with EC2-VPC.

Parameters:
allocationId The ID representing the allocation of the address for use with EC2-VPC.
    public void setAllocationId(String allocationId) {
        this. = allocationId;
    }
    
    
The ID representing the allocation of the address for use with EC2-VPC.

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

Parameters:
allocationId The ID representing the allocation of the address for use with EC2-VPC.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Address withAllocationId(String allocationId) {
        this. = allocationId;
        return this;
    }

    
The ID representing the association of the address with an instance in a VPC.

Returns:
The ID representing the association of the address with an instance in a VPC.
    public String getAssociationId() {
        return ;
    }
    
    
The ID representing the association of the address with an instance in a VPC.

Parameters:
associationId The ID representing the association of the address with an instance in a VPC.
    public void setAssociationId(String associationId) {
        this. = associationId;
    }
    
    
The ID representing the association of the address with an instance in a VPC.

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

Parameters:
associationId The ID representing the association of the address with an instance in a VPC.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Address withAssociationId(String associationId) {
        this. = associationId;
        return this;
    }

    
Indicates whether this Elastic IP address is for use with instances in EC2-Classic (standard) or instances in a VPC (vpc).

Constraints:
Allowed Values: vpc, standard

Returns:
Indicates whether this Elastic IP address is for use with instances in EC2-Classic (standard) or instances in a VPC (vpc).
See also:
DomainType
    public String getDomain() {
        return ;
    }
    
    
Indicates whether this Elastic IP address is for use with instances in EC2-Classic (standard) or instances in a VPC (vpc).

Constraints:
Allowed Values: vpc, standard

Parameters:
domain Indicates whether this Elastic IP address is for use with instances in EC2-Classic (standard) or instances in a VPC (vpc).
See also:
DomainType
    public void setDomain(String domain) {
        this. = domain;
    }
    
    
Indicates whether this Elastic IP address is for use with instances in EC2-Classic (standard) or instances in a VPC (vpc).

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

Constraints:
Allowed Values: vpc, standard

Parameters:
domain Indicates whether this Elastic IP address is for use with instances in EC2-Classic (standard) or instances in a VPC (vpc).
Returns:
A reference to this updated object so that method calls can be chained together.
See also:
DomainType
    public Address withDomain(String domain) {
        this. = domain;
        return this;
    }

    
Indicates whether this Elastic IP address is for use with instances in EC2-Classic (standard) or instances in a VPC (vpc).

Constraints:
Allowed Values: vpc, standard

Parameters:
domain Indicates whether this Elastic IP address is for use with instances in EC2-Classic (standard) or instances in a VPC (vpc).
See also:
DomainType
    public void setDomain(DomainType domain) {
        this. = domain.toString();
    }
    
    
Indicates whether this Elastic IP address is for use with instances in EC2-Classic (standard) or instances in a VPC (vpc).

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

Constraints:
Allowed Values: vpc, standard

Parameters:
domain Indicates whether this Elastic IP address is for use with instances in EC2-Classic (standard) or instances in a VPC (vpc).
Returns:
A reference to this updated object so that method calls can be chained together.
See also:
DomainType
    public Address withDomain(DomainType domain) {
        this. = domain.toString();
        return this;
    }

    
The ID of the network interface.

Returns:
The ID of the network interface.
    public String getNetworkInterfaceId() {
        return ;
    }
    
    
The ID of the network interface.

Parameters:
networkInterfaceId The ID of the network interface.
    public void setNetworkInterfaceId(String networkInterfaceId) {
        this. = networkInterfaceId;
    }
    
    
The ID of the network interface.

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

Parameters:
networkInterfaceId The ID of the network interface.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Address withNetworkInterfaceId(String networkInterfaceId) {
        this. = networkInterfaceId;
        return this;
    }

    
The ID of the AWS account that owns the network interface.

Returns:
The ID of the AWS account that owns the network interface.
        return ;
    }
    
    
The ID of the AWS account that owns the network interface.

Parameters:
networkInterfaceOwnerId The ID of the AWS account that owns the network interface.
    public void setNetworkInterfaceOwnerId(String networkInterfaceOwnerId) {
        this. = networkInterfaceOwnerId;
    }
    
    
The ID of the AWS account that owns the network interface.

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

Parameters:
networkInterfaceOwnerId The ID of the AWS account that owns the network interface.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Address withNetworkInterfaceOwnerId(String networkInterfaceOwnerId) {
        this. = networkInterfaceOwnerId;
        return this;
    }

    
The private IP address associated with the Elastic IP address.

Returns:
The private IP address associated with the Elastic IP address.
    public String getPrivateIpAddress() {
        return ;
    }
    
    
The private IP address associated with the Elastic IP address.

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

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

Parameters:
privateIpAddress The private IP address associated with the Elastic IP address.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Address withPrivateIpAddress(String privateIpAddress) {
        this. = privateIpAddress;
        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 (getInstanceId() != nullsb.append("InstanceId: " + getInstanceId() + ",");
        if (getPublicIp() != nullsb.append("PublicIp: " + getPublicIp() + ",");
        if (getAllocationId() != nullsb.append("AllocationId: " + getAllocationId() + ",");
        if (getAssociationId() != nullsb.append("AssociationId: " + getAssociationId() + ",");
        if (getDomain() != nullsb.append("Domain: " + getDomain() + ",");
        if (getNetworkInterfaceId() != nullsb.append("NetworkInterfaceId: " + getNetworkInterfaceId() + ",");
        if (getNetworkInterfaceOwnerId() != nullsb.append("NetworkInterfaceOwnerId: " + getNetworkInterfaceOwnerId() + ",");
        if (getPrivateIpAddress() != nullsb.append("PrivateIpAddress: " + getPrivateIpAddress() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getInstanceId() == null) ? 0 : getInstanceId().hashCode()); 
        hashCode = prime * hashCode + ((getPublicIp() == null) ? 0 : getPublicIp().hashCode()); 
        hashCode = prime * hashCode + ((getAllocationId() == null) ? 0 : getAllocationId().hashCode()); 
        hashCode = prime * hashCode + ((getAssociationId() == null) ? 0 : getAssociationId().hashCode()); 
        hashCode = prime * hashCode + ((getDomain() == null) ? 0 : getDomain().hashCode()); 
        hashCode = prime * hashCode + ((getNetworkInterfaceId() == null) ? 0 : getNetworkInterfaceId().hashCode()); 
        hashCode = prime * hashCode + ((getNetworkInterfaceOwnerId() == null) ? 0 : getNetworkInterfaceOwnerId().hashCode()); 
        hashCode = prime * hashCode + ((getPrivateIpAddress() == null) ? 0 : getPrivateIpAddress().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof Address == falsereturn false;
        Address other = (Address)obj;
        
        if (other.getInstanceId() == null ^ this.getInstanceId() == nullreturn false;
        if (other.getInstanceId() != null && other.getInstanceId().equals(this.getInstanceId()) == falsereturn false
        if (other.getPublicIp() == null ^ this.getPublicIp() == nullreturn false;
        if (other.getPublicIp() != null && other.getPublicIp().equals(this.getPublicIp()) == falsereturn false
        if (other.getAllocationId() == null ^ this.getAllocationId() == nullreturn false;
        if (other.getAllocationId() != null && other.getAllocationId().equals(this.getAllocationId()) == falsereturn false
        if (other.getAssociationId() == null ^ this.getAssociationId() == nullreturn false;
        if (other.getAssociationId() != null && other.getAssociationId().equals(this.getAssociationId()) == falsereturn false
        if (other.getDomain() == null ^ this.getDomain() == nullreturn false;
        if (other.getDomain() != null && other.getDomain().equals(this.getDomain()) == falsereturn false
        if (other.getNetworkInterfaceId() == null ^ this.getNetworkInterfaceId() == nullreturn false;
        if (other.getNetworkInterfaceId() != null && other.getNetworkInterfaceId().equals(this.getNetworkInterfaceId()) == falsereturn false
        if (other.getNetworkInterfaceOwnerId() == null ^ this.getNetworkInterfaceOwnerId() == nullreturn false;
        if (other.getNetworkInterfaceOwnerId() != null && other.getNetworkInterfaceOwnerId().equals(this.getNetworkInterfaceOwnerId()) == falsereturn false
        if (other.getPrivateIpAddress() == null ^ this.getPrivateIpAddress() == nullreturn false;
        if (other.getPrivateIpAddress() != null && other.getPrivateIpAddress().equals(this.getPrivateIpAddress()) == falsereturn false
        return true;
    }
    
    @Override
    public Address clone() {
        try {
            return (Addresssuper.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