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 the placement for the instance.

 
 public class Placement implements SerializableCloneable {

    
The Availability Zone of the instance.
 
     private String availabilityZone;

    
The name of the placement group the instance is in (for cluster compute instances).
 
     private String groupName;

    
The tenancy of the instance (if the instance is running in a VPC). An instance with a tenancy of dedicated runs on single-tenant hardware.

Constraints:
Allowed Values: default, dedicated

 
     private String tenancy;

    
Default constructor for a new Placement object. Callers should use the setter or fluent setter (with...) methods to initialize this object after creating it.
 
     public Placement() {}
    
    
Constructs a new Placement object. Callers should use the setter or fluent setter (with...) methods to initialize any additional object members.

Parameters:
availabilityZone The Availability Zone of the instance.
 
     public Placement(String availabilityZone) {
         setAvailabilityZone(availabilityZone);
     }

    
The Availability Zone of the instance.

Returns:
The Availability Zone of the instance.
 
     public String getAvailabilityZone() {
         return ;
     }
    
    
The Availability Zone of the instance.

Parameters:
availabilityZone The Availability Zone of the instance.
 
     public void setAvailabilityZone(String availabilityZone) {
         this. = availabilityZone;
     }
    
    
The Availability Zone of the instance.

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

Parameters:
availabilityZone The Availability Zone of the instance.
Returns:
A reference to this updated object so that method calls can be chained together.
 
     public Placement withAvailabilityZone(String availabilityZone) {
         this. = availabilityZone;
         return this;
     }

    
The name of the placement group the instance is in (for cluster compute instances).

Returns:
The name of the placement group the instance is in (for cluster compute instances).
    public String getGroupName() {
        return ;
    }
    
    
The name of the placement group the instance is in (for cluster compute instances).

Parameters:
groupName The name of the placement group the instance is in (for cluster compute instances).
    public void setGroupName(String groupName) {
        this. = groupName;
    }
    
    
The name of the placement group the instance is in (for cluster compute instances).

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

Parameters:
groupName The name of the placement group the instance is in (for cluster compute instances).
Returns:
A reference to this updated object so that method calls can be chained together.
    public Placement withGroupName(String groupName) {
        this. = groupName;
        return this;
    }

    
The tenancy of the instance (if the instance is running in a VPC). An instance with a tenancy of dedicated runs on single-tenant hardware.

Constraints:
Allowed Values: default, dedicated

Returns:
The tenancy of the instance (if the instance is running in a VPC). An instance with a tenancy of dedicated runs on single-tenant hardware.
See also:
Tenancy
    public String getTenancy() {
        return ;
    }
    
    
The tenancy of the instance (if the instance is running in a VPC). An instance with a tenancy of dedicated runs on single-tenant hardware.

Constraints:
Allowed Values: default, dedicated

Parameters:
tenancy The tenancy of the instance (if the instance is running in a VPC). An instance with a tenancy of dedicated runs on single-tenant hardware.
See also:
Tenancy
    public void setTenancy(String tenancy) {
        this. = tenancy;
    }
    
    
The tenancy of the instance (if the instance is running in a VPC). An instance with a tenancy of dedicated runs on single-tenant hardware.

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

Constraints:
Allowed Values: default, dedicated

Parameters:
tenancy The tenancy of the instance (if the instance is running in a VPC). An instance with a tenancy of dedicated runs on single-tenant hardware.
Returns:
A reference to this updated object so that method calls can be chained together.
See also:
Tenancy
    public Placement withTenancy(String tenancy) {
        this. = tenancy;
        return this;
    }

    
The tenancy of the instance (if the instance is running in a VPC). An instance with a tenancy of dedicated runs on single-tenant hardware.

Constraints:
Allowed Values: default, dedicated

Parameters:
tenancy The tenancy of the instance (if the instance is running in a VPC). An instance with a tenancy of dedicated runs on single-tenant hardware.
See also:
Tenancy
    public void setTenancy(Tenancy tenancy) {
        this. = tenancy.toString();
    }
    
    
The tenancy of the instance (if the instance is running in a VPC). An instance with a tenancy of dedicated runs on single-tenant hardware.

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

Constraints:
Allowed Values: default, dedicated

Parameters:
tenancy The tenancy of the instance (if the instance is running in a VPC). An instance with a tenancy of dedicated runs on single-tenant hardware.
Returns:
A reference to this updated object so that method calls can be chained together.
See also:
Tenancy
    public Placement withTenancy(Tenancy tenancy) {
        this. = tenancy.toString();
        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 (getAvailabilityZone() != nullsb.append("AvailabilityZone: " + getAvailabilityZone() + ",");
        if (getGroupName() != nullsb.append("GroupName: " + getGroupName() + ",");
        if (getTenancy() != nullsb.append("Tenancy: " + getTenancy() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getAvailabilityZone() == null) ? 0 : getAvailabilityZone().hashCode()); 
        hashCode = prime * hashCode + ((getGroupName() == null) ? 0 : getGroupName().hashCode()); 
        hashCode = prime * hashCode + ((getTenancy() == null) ? 0 : getTenancy().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof Placement == falsereturn false;
        Placement other = (Placement)obj;
        
        if (other.getAvailabilityZone() == null ^ this.getAvailabilityZone() == nullreturn false;
        if (other.getAvailabilityZone() != null && other.getAvailabilityZone().equals(this.getAvailabilityZone()) == falsereturn false
        if (other.getGroupName() == null ^ this.getGroupName() == nullreturn false;
        if (other.getGroupName() != null && other.getGroupName().equals(this.getGroupName()) == falsereturn false
        if (other.getTenancy() == null ^ this.getTenancy() == nullreturn false;
        if (other.getTenancy() != null && other.getTenancy().equals(this.getTenancy()) == falsereturn false
        return true;
    }
    
    @Override
    public Placement clone() {
        try {
            return (Placementsuper.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