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 a launch permission modification.

 
 public class LaunchPermissionModifications implements SerializableCloneable {

    
The AWS account ID to add to the list of launch permissions for the AMI.
 
The AWS account ID to remove from the list of launch permissions for the AMI.
 
The AWS account ID to add to the list of launch permissions for the AMI.

Returns:
The AWS account ID to add to the list of launch permissions for the AMI.
 
     public java.util.List<LaunchPermissiongetAdd() {
         if ( == null) {
                = new com.amazonaws.internal.ListWithAutoConstructFlag<LaunchPermission>();
               .setAutoConstruct(true);
         }
         return ;
     }
    
    
The AWS account ID to add to the list of launch permissions for the AMI.

Parameters:
add The AWS account ID to add to the list of launch permissions for the AMI.
 
     public void setAdd(java.util.Collection<LaunchPermissionadd) {
         if (add == null) {
             this. = null;
             return;
         }
         addCopy.addAll(add);
         this. = addCopy;
     }
    
    
The AWS account ID to add to the list of launch permissions for the AMI.

NOTE: This method appends the values to the existing list (if any). Use setAdd(java.util.Collection) or withAdd(java.util.Collection) if you want to override the existing values.

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

Parameters:
add The AWS account ID to add to the list of launch permissions for the AMI.
Returns:
A reference to this updated object so that method calls can be chained together.
 
         if (getAdd() == nullsetAdd(new java.util.ArrayList<LaunchPermission>(add.length));
         for (LaunchPermission value : add) {
             getAdd().add(value);
         }
         return this;
     }
    
    
The AWS account ID to add to the list of launch permissions for the AMI.

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

Parameters:
add The AWS account ID to add to the list of launch permissions for the AMI.
Returns:
A reference to this updated object so that method calls can be chained together.
        if (add == null) {
            this. = null;
        } else {
            addCopy.addAll(add);
            this. = addCopy;
        }
        return this;
    }

    
The AWS account ID to remove from the list of launch permissions for the AMI.

Returns:
The AWS account ID to remove from the list of launch permissions for the AMI.
    public java.util.List<LaunchPermissiongetRemove() {
        if ( == null) {
              .setAutoConstruct(true);
        }
        return ;
    }
    
    
The AWS account ID to remove from the list of launch permissions for the AMI.

Parameters:
remove The AWS account ID to remove from the list of launch permissions for the AMI.
    public void setRemove(java.util.Collection<LaunchPermissionremove) {
        if (remove == null) {
            this. = null;
            return;
        }
        removeCopy.addAll(remove);
        this. = removeCopy;
    }
    
    
The AWS account ID to remove from the list of launch permissions for the AMI.

NOTE: This method appends the values to the existing list (if any). Use setRemove(java.util.Collection) or withRemove(java.util.Collection) if you want to override the existing values.

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

Parameters:
remove The AWS account ID to remove from the list of launch permissions for the AMI.
Returns:
A reference to this updated object so that method calls can be chained together.
        if (getRemove() == nullsetRemove(new java.util.ArrayList<LaunchPermission>(remove.length));
        for (LaunchPermission value : remove) {
            getRemove().add(value);
        }
        return this;
    }
    
    
The AWS account ID to remove from the list of launch permissions for the AMI.

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

Parameters:
remove The AWS account ID to remove from the list of launch permissions for the AMI.
Returns:
A reference to this updated object so that method calls can be chained together.
        if (remove == null) {
            this. = null;
        } else {
            removeCopy.addAll(remove);
            this. = removeCopy;
        }
        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 (getAdd() != nullsb.append("Add: " + getAdd() + ",");
        if (getRemove() != nullsb.append("Remove: " + getRemove() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getAdd() == null) ? 0 : getAdd().hashCode()); 
        hashCode = prime * hashCode + ((getRemove() == null) ? 0 : getRemove().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof LaunchPermissionModifications == falsereturn false;
        
        if (other.getAdd() == null ^ this.getAdd() == nullreturn false;
        if (other.getAdd() != null && other.getAdd().equals(this.getAdd()) == falsereturn false
        if (other.getRemove() == null ^ this.getRemove() == nullreturn false;
        if (other.getRemove() != null && other.getRemove().equals(this.getRemove()) == falsereturn false
        return true;
    }
    
    @Override
        try {
            return (LaunchPermissionModificationssuper.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