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 DHCP configuration option.

 
 public class DhcpConfiguration implements SerializableCloneable {

    
The name of a DHCP option.
 
     private String key;

    
One or more values for the DHCP option.
 
The name of a DHCP option.

Returns:
The name of a DHCP option.
 
     public String getKey() {
         return ;
     }
    
    
The name of a DHCP option.

Parameters:
key The name of a DHCP option.
 
     public void setKey(String key) {
         this. = key;
     }
    
    
The name of a DHCP option.

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

Parameters:
key The name of a DHCP option.
Returns:
A reference to this updated object so that method calls can be chained together.
 
     public DhcpConfiguration withKey(String key) {
         this. = key;
         return this;
     }

    
One or more values for the DHCP option.

Returns:
One or more values for the DHCP option.
 
     public java.util.List<StringgetValues() {
         if ( == null) {
                = new com.amazonaws.internal.ListWithAutoConstructFlag<String>();
               .setAutoConstruct(true);
         }
         return ;
     }
    
    
One or more values for the DHCP option.

Parameters:
values One or more values for the DHCP option.
 
     public void setValues(java.util.Collection<Stringvalues) {
         if (values == null) {
             this. = null;
             return;
         }
         valuesCopy.addAll(values);
         this. = valuesCopy;
     }
    
    
One or more values for the DHCP option.

NOTE: This method appends the values to the existing list (if any). Use setValues(java.util.Collection) or withValues(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:
values One or more values for the DHCP option.
Returns:
A reference to this updated object so that method calls can be chained together.
    public DhcpConfiguration withValues(String... values) {
        if (getValues() == nullsetValues(new java.util.ArrayList<String>(values.length));
        for (String value : values) {
            getValues().add(value);
        }
        return this;
    }
    
    
One or more values for the DHCP option.

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

Parameters:
values One or more values for the DHCP option.
Returns:
A reference to this updated object so that method calls can be chained together.
        if (values == null) {
            this. = null;
        } else {
            valuesCopy.addAll(values);
            this. = valuesCopy;
        }
        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 (getKey() != nullsb.append("Key: " + getKey() + ",");
        if (getValues() != nullsb.append("Values: " + getValues() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getKey() == null) ? 0 : getKey().hashCode()); 
        hashCode = prime * hashCode + ((getValues() == null) ? 0 : getValues().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof DhcpConfiguration == falsereturn false;
        DhcpConfiguration other = (DhcpConfiguration)obj;
        
        if (other.getKey() == null ^ this.getKey() == nullreturn false;
        if (other.getKey() != null && other.getKey().equals(this.getKey()) == falsereturn false
        if (other.getValues() == null ^ this.getValues() == nullreturn false;
        if (other.getValues() != null && other.getValues().equals(this.getValues()) == falsereturn false
        return true;
    }
    
    @Override
    public DhcpConfiguration clone() {
        try {
            return (DhcpConfigurationsuper.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