Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2010-2014 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 image attribute.

 
 public class ImageAttribute implements Serializable {

    
The ID of the AMI.
 
     private String imageId;

    
One or more launch permissions.
 
     private com.amazonaws.internal.ListWithAutoConstructFlag<LaunchPermission> launchPermissions;

    
One or more product codes.
 
     private com.amazonaws.internal.ListWithAutoConstructFlag<ProductCode> productCodes;

    
The kernel ID.
 
     private String kernelId;

    
The RAM disk ID.
 
     private String ramdiskId;

    
A description for the AMI.
 
     private String description;

    
 
     private String sriovNetSupport;

    
One or more block device mapping entries.
 
     private com.amazonaws.internal.ListWithAutoConstructFlag<BlockDeviceMapping> blockDeviceMappings;

    
The ID of the AMI.

Returns:
The ID of the AMI.
 
     public String getImageId() {
         return ;
     }
    
    
The ID of the AMI.

Parameters:
imageId The ID of the AMI.
 
     public void setImageId(String imageId) {
         this. = imageId;
     }
    
    
The ID of the AMI.

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

Parameters:
imageId The ID of the AMI.
Returns:
A reference to this updated object so that method calls can be chained together.
 
     public ImageAttribute withImageId(String imageId) {
         this. = imageId;
         return this;
     }

    
One or more launch permissions.

Returns:
One or more launch permissions.
    public java.util.List<LaunchPermission> getLaunchPermissions() {
        if ( == null) {
               = new com.amazonaws.internal.ListWithAutoConstructFlag<LaunchPermission>();
              .setAutoConstruct(true);
        }
        return ;
    }
    
    
One or more launch permissions.

Parameters:
launchPermissions One or more launch permissions.
    public void setLaunchPermissions(java.util.Collection<LaunchPermission> launchPermissions) {
        if (launchPermissions == null) {
            this. = null;
            return;
        }
        com.amazonaws.internal.ListWithAutoConstructFlag<LaunchPermission> launchPermissionsCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<LaunchPermission>(launchPermissions.size());
        launchPermissionsCopy.addAll(launchPermissions);
        this. = launchPermissionsCopy;
    }
    
    
One or more launch permissions.

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

Parameters:
launchPermissions One or more launch permissions.
Returns:
A reference to this updated object so that method calls can be chained together.
    public ImageAttribute withLaunchPermissions(LaunchPermission... launchPermissions) {
        if (getLaunchPermissions() == nullsetLaunchPermissions(new java.util.ArrayList<LaunchPermission>(launchPermissions.length));
        for (LaunchPermission value : launchPermissions) {
            getLaunchPermissions().add(value);
        }
        return this;
    }
    
    
One or more launch permissions.

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

Parameters:
launchPermissions One or more launch permissions.
Returns:
A reference to this updated object so that method calls can be chained together.
    public ImageAttribute withLaunchPermissions(java.util.Collection<LaunchPermission> launchPermissions) {
        if (launchPermissions == null) {
            this. = null;
        } else {
            com.amazonaws.internal.ListWithAutoConstructFlag<LaunchPermission> launchPermissionsCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<LaunchPermission>(launchPermissions.size());
            launchPermissionsCopy.addAll(launchPermissions);
            this. = launchPermissionsCopy;
        }
        return this;
    }

    
One or more product codes.

Returns:
One or more product codes.
    public java.util.List<ProductCode> getProductCodes() {
        if ( == null) {
               = new com.amazonaws.internal.ListWithAutoConstructFlag<ProductCode>();
              .setAutoConstruct(true);
        }
        return ;
    }
    
    
One or more product codes.

Parameters:
productCodes One or more product codes.
    public void setProductCodes(java.util.Collection<ProductCode> productCodes) {
        if (productCodes == null) {
            this. = null;
            return;
        }
        com.amazonaws.internal.ListWithAutoConstructFlag<ProductCode> productCodesCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<ProductCode>(productCodes.size());
        productCodesCopy.addAll(productCodes);
        this. = productCodesCopy;
    }
    
    
One or more product codes.

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

Parameters:
productCodes One or more product codes.
Returns:
A reference to this updated object so that method calls can be chained together.
    public ImageAttribute withProductCodes(ProductCode... productCodes) {
        if (getProductCodes() == nullsetProductCodes(new java.util.ArrayList<ProductCode>(productCodes.length));
        for (ProductCode value : productCodes) {
            getProductCodes().add(value);
        }
        return this;
    }
    
    
One or more product codes.

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

Parameters:
productCodes One or more product codes.
Returns:
A reference to this updated object so that method calls can be chained together.
    public ImageAttribute withProductCodes(java.util.Collection<ProductCode> productCodes) {
        if (productCodes == null) {
            this. = null;
        } else {
            com.amazonaws.internal.ListWithAutoConstructFlag<ProductCode> productCodesCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<ProductCode>(productCodes.size());
            productCodesCopy.addAll(productCodes);
            this. = productCodesCopy;
        }
        return this;
    }

    
The kernel ID.

Returns:
The kernel ID.
    public String getKernelId() {
        return ;
    }
    
    
The kernel ID.

Parameters:
kernelId The kernel ID.
    public void setKernelId(String kernelId) {
        this. = kernelId;
    }
    
    
The kernel ID.

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

Parameters:
kernelId The kernel ID.
Returns:
A reference to this updated object so that method calls can be chained together.
    public ImageAttribute withKernelId(String kernelId) {
        this. = kernelId;
        return this;
    }

    
The RAM disk ID.

Returns:
The RAM disk ID.
    public String getRamdiskId() {
        return ;
    }
    
    
The RAM disk ID.

Parameters:
ramdiskId The RAM disk ID.
    public void setRamdiskId(String ramdiskId) {
        this. = ramdiskId;
    }
    
    
The RAM disk ID.

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

Parameters:
ramdiskId The RAM disk ID.
Returns:
A reference to this updated object so that method calls can be chained together.
    public ImageAttribute withRamdiskId(String ramdiskId) {
        this. = ramdiskId;
        return this;
    }

    
A description for the AMI.

Returns:
A description for the AMI.
    public String getDescription() {
        return ;
    }
    
    
A description for the AMI.

Parameters:
description A description for the AMI.
    public void setDescription(String description) {
        this. = description;
    }
    
    
A description for the AMI.

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

Parameters:
description A description for the AMI.
Returns:
A reference to this updated object so that method calls can be chained together.
    public ImageAttribute withDescription(String description) {
        this. = description;
        return this;
    }

    

Returns:
    public String getSriovNetSupport() {
        return ;
    }
    
    

Parameters:
sriovNetSupport
    public void setSriovNetSupport(String sriovNetSupport) {
        this. = sriovNetSupport;
    }
    
    

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

Parameters:
sriovNetSupport
Returns:
A reference to this updated object so that method calls can be chained together.
    public ImageAttribute withSriovNetSupport(String sriovNetSupport) {
        this. = sriovNetSupport;
        return this;
    }

    
One or more block device mapping entries.

Returns:
One or more block device mapping entries.
    public java.util.List<BlockDeviceMapping> getBlockDeviceMappings() {
        if ( == null) {
               = new com.amazonaws.internal.ListWithAutoConstructFlag<BlockDeviceMapping>();
              .setAutoConstruct(true);
        }
        return ;
    }
    
    
One or more block device mapping entries.

Parameters:
blockDeviceMappings One or more block device mapping entries.
    public void setBlockDeviceMappings(java.util.Collection<BlockDeviceMapping> blockDeviceMappings) {
        if (blockDeviceMappings == null) {
            this. = null;
            return;
        }
        com.amazonaws.internal.ListWithAutoConstructFlag<BlockDeviceMapping> blockDeviceMappingsCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<BlockDeviceMapping>(blockDeviceMappings.size());
        blockDeviceMappingsCopy.addAll(blockDeviceMappings);
        this. = blockDeviceMappingsCopy;
    }
    
    
One or more block device mapping entries.

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

Parameters:
blockDeviceMappings One or more block device mapping entries.
Returns:
A reference to this updated object so that method calls can be chained together.
    public ImageAttribute withBlockDeviceMappings(BlockDeviceMapping... blockDeviceMappings) {
        if (getBlockDeviceMappings() == nullsetBlockDeviceMappings(new java.util.ArrayList<BlockDeviceMapping>(blockDeviceMappings.length));
        for (BlockDeviceMapping value : blockDeviceMappings) {
            getBlockDeviceMappings().add(value);
        }
        return this;
    }
    
    
One or more block device mapping entries.

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

Parameters:
blockDeviceMappings One or more block device mapping entries.
Returns:
A reference to this updated object so that method calls can be chained together.
    public ImageAttribute withBlockDeviceMappings(java.util.Collection<BlockDeviceMapping> blockDeviceMappings) {
        if (blockDeviceMappings == null) {
            this. = null;
        } else {
            com.amazonaws.internal.ListWithAutoConstructFlag<BlockDeviceMapping> blockDeviceMappingsCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<BlockDeviceMapping>(blockDeviceMappings.size());
            blockDeviceMappingsCopy.addAll(blockDeviceMappings);
            this. = blockDeviceMappingsCopy;
        }
        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 (getImageId() != nullsb.append("ImageId: " + getImageId() + ",");
        if (getLaunchPermissions() != nullsb.append("LaunchPermissions: " + getLaunchPermissions() + ",");
        if (getProductCodes() != nullsb.append("ProductCodes: " + getProductCodes() + ",");
        if (getKernelId() != nullsb.append("KernelId: " + getKernelId() + ",");
        if (getRamdiskId() != nullsb.append("RamdiskId: " + getRamdiskId() + ",");
        if (getDescription() != nullsb.append("Description: " + getDescription() + ",");
        if (getSriovNetSupport() != nullsb.append("SriovNetSupport: " + getSriovNetSupport() + ",");
        if (getBlockDeviceMappings() != nullsb.append("BlockDeviceMappings: " + getBlockDeviceMappings() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getImageId() == null) ? 0 : getImageId().hashCode()); 
        hashCode = prime * hashCode + ((getLaunchPermissions() == null) ? 0 : getLaunchPermissions().hashCode()); 
        hashCode = prime * hashCode + ((getProductCodes() == null) ? 0 : getProductCodes().hashCode()); 
        hashCode = prime * hashCode + ((getKernelId() == null) ? 0 : getKernelId().hashCode()); 
        hashCode = prime * hashCode + ((getRamdiskId() == null) ? 0 : getRamdiskId().hashCode()); 
        hashCode = prime * hashCode + ((getDescription() == null) ? 0 : getDescription().hashCode()); 
        hashCode = prime * hashCode + ((getSriovNetSupport() == null) ? 0 : getSriovNetSupport().hashCode()); 
        hashCode = prime * hashCode + ((getBlockDeviceMappings() == null) ? 0 : getBlockDeviceMappings().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof ImageAttribute == falsereturn false;
        ImageAttribute other = (ImageAttribute)obj;
        
        if (other.getImageId() == null ^ this.getImageId() == nullreturn false;
        if (other.getImageId() != null && other.getImageId().equals(this.getImageId()) == falsereturn false
        if (other.getLaunchPermissions() == null ^ this.getLaunchPermissions() == nullreturn false;
        if (other.getLaunchPermissions() != null && other.getLaunchPermissions().equals(this.getLaunchPermissions()) == falsereturn false
        if (other.getProductCodes() == null ^ this.getProductCodes() == nullreturn false;
        if (other.getProductCodes() != null && other.getProductCodes().equals(this.getProductCodes()) == falsereturn false
        if (other.getKernelId() == null ^ this.getKernelId() == nullreturn false;
        if (other.getKernelId() != null && other.getKernelId().equals(this.getKernelId()) == falsereturn false
        if (other.getRamdiskId() == null ^ this.getRamdiskId() == nullreturn false;
        if (other.getRamdiskId() != null && other.getRamdiskId().equals(this.getRamdiskId()) == falsereturn false
        if (other.getDescription() == null ^ this.getDescription() == nullreturn false;
        if (other.getDescription() != null && other.getDescription().equals(this.getDescription()) == falsereturn false
        if (other.getSriovNetSupport() == null ^ this.getSriovNetSupport() == nullreturn false;
        if (other.getSriovNetSupport() != null && other.getSriovNetSupport().equals(this.getSriovNetSupport()) == falsereturn false
        if (other.getBlockDeviceMappings() == null ^ this.getBlockDeviceMappings() == nullreturn false;
        if (other.getBlockDeviceMappings() != null && other.getBlockDeviceMappings().equals(this.getBlockDeviceMappings()) == falsereturn false
        return true;
    }
    
}
    
New to GrepCode? Check out our FAQ X