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.elasticloadbalancing.model;
 
 
Container for the parameters to the AddTags operation.

Adds the specified tags to the specified load balancer. Each load balancer can have a maximum of 10 tags.

Each tag consists of a key and an optional value. If a tag with the same key is already associated with the load balancer, AddTags updates its value.

For more information, see Tagging in the Elastic Load Balancing Developer Guide .

 
 public class AddTagsRequest extends AmazonWebServiceRequest implements SerializableCloneable {

    
The name of the load balancer. You can specify one load balancer only.
 
The tags.

Constraints:
Length: 1 -

 
The name of the load balancer. You can specify one load balancer only.

Returns:
The name of the load balancer. You can specify one load balancer only.
 
     public java.util.List<StringgetLoadBalancerNames() {
         if ( == null) {
                = new com.amazonaws.internal.ListWithAutoConstructFlag<String>();
               .setAutoConstruct(true);
         }
         return ;
     }
    
    
The name of the load balancer. You can specify one load balancer only.

Parameters:
loadBalancerNames The name of the load balancer. You can specify one load balancer only.
 
     public void setLoadBalancerNames(java.util.Collection<StringloadBalancerNames) {
         if (loadBalancerNames == null) {
             this. = null;
             return;
         }
         com.amazonaws.internal.ListWithAutoConstructFlag<StringloadBalancerNamesCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<String>(loadBalancerNames.size());
         loadBalancerNamesCopy.addAll(loadBalancerNames);
         this. = loadBalancerNamesCopy;
     }
    
    
The name of the load balancer. You can specify one load balancer only.

NOTE: This method appends the values to the existing list (if any). Use setLoadBalancerNames(java.util.Collection) or withLoadBalancerNames(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:
loadBalancerNames The name of the load balancer. You can specify one load balancer only.
Returns:
A reference to this updated object so that method calls can be chained together.
 
     public AddTagsRequest withLoadBalancerNames(String... loadBalancerNames) {
         if (getLoadBalancerNames() == nullsetLoadBalancerNames(new java.util.ArrayList<String>(loadBalancerNames.length));
        for (String value : loadBalancerNames) {
            getLoadBalancerNames().add(value);
        }
        return this;
    }
    
    
The name of the load balancer. You can specify one load balancer only.

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

Parameters:
loadBalancerNames The name of the load balancer. You can specify one load balancer only.
Returns:
A reference to this updated object so that method calls can be chained together.
    public AddTagsRequest withLoadBalancerNames(java.util.Collection<StringloadBalancerNames) {
        if (loadBalancerNames == null) {
            this. = null;
        } else {
            com.amazonaws.internal.ListWithAutoConstructFlag<StringloadBalancerNamesCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<String>(loadBalancerNames.size());
            loadBalancerNamesCopy.addAll(loadBalancerNames);
            this. = loadBalancerNamesCopy;
        }
        return this;
    }

    
The tags.

Constraints:
Length: 1 -

Returns:
The tags.
    public java.util.List<TaggetTags() {
        if ( == null) {
               = new com.amazonaws.internal.ListWithAutoConstructFlag<Tag>();
              .setAutoConstruct(true);
        }
        return ;
    }
    
    
The tags.

Constraints:
Length: 1 -

Parameters:
tags The tags.
    public void setTags(java.util.Collection<Tagtags) {
        if (tags == null) {
            this. = null;
            return;
        }
        tagsCopy.addAll(tags);
        this. = tagsCopy;
    }
    
    
The tags.

NOTE: This method appends the values to the existing list (if any). Use setTags(java.util.Collection) or withTags(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.

Constraints:
Length: 1 -

Parameters:
tags The tags.
Returns:
A reference to this updated object so that method calls can be chained together.
    public AddTagsRequest withTags(Tag... tags) {
        if (getTags() == nullsetTags(new java.util.ArrayList<Tag>(tags.length));
        for (Tag value : tags) {
            getTags().add(value);
        }
        return this;
    }
    
    
The tags.

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

Constraints:
Length: 1 -

Parameters:
tags The tags.
Returns:
A reference to this updated object so that method calls can be chained together.
    public AddTagsRequest withTags(java.util.Collection<Tagtags) {
        if (tags == null) {
            this. = null;
        } else {
            tagsCopy.addAll(tags);
            this. = tagsCopy;
        }
        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 (getLoadBalancerNames() != nullsb.append("LoadBalancerNames: " + getLoadBalancerNames() + ",");
        if (getTags() != nullsb.append("Tags: " + getTags() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getLoadBalancerNames() == null) ? 0 : getLoadBalancerNames().hashCode()); 
        hashCode = prime * hashCode + ((getTags() == null) ? 0 : getTags().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof AddTagsRequest == falsereturn false;
        AddTagsRequest other = (AddTagsRequest)obj;
        
        if (other.getLoadBalancerNames() == null ^ this.getLoadBalancerNames() == nullreturn false;
        if (other.getLoadBalancerNames() != null && other.getLoadBalancerNames().equals(this.getLoadBalancerNames()) == falsereturn false
        if (other.getTags() == null ^ this.getTags() == nullreturn false;
        if (other.getTags() != null && other.getTags().equals(this.getTags()) == falsereturn false
        return true;
    }
    
    @Override
    public AddTagsRequest clone() {
        
            return (AddTagsRequestsuper.clone();
    }
}
    
New to GrepCode? Check out our FAQ X