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.ecs.model;
 

Describes the resources available for a container instance.

 
 public class Resource implements SerializableCloneable {

    
The name of the resource, such as CPU, MEMORY, PORTS, or a user-defined resource.
 
     private String name;

    
The type of the resource, such as INTEGER, DOUBLE, LONG, or STRINGSET.
 
     private String type;

    
When the doubleValue type is set, the value of the resource must be a double precision floating-point type.
 
     private Double doubleValue;

    
When the longValue type is set, the value of the resource must be an extended precision floating-point type.
 
     private Long longValue;

    
When the integerValue type is set, the value of the resource must be an integer.
 
     private Integer integerValue;

    
When the stringSetValue type is set, the value of the resource must be a string type.
 
The name of the resource, such as CPU, MEMORY, PORTS, or a user-defined resource.

Returns:
The name of the resource, such as CPU, MEMORY, PORTS, or a user-defined resource.
 
     public String getName() {
         return ;
     }
    
    
The name of the resource, such as CPU, MEMORY, PORTS, or a user-defined resource.

Parameters:
name The name of the resource, such as CPU, MEMORY, PORTS, or a user-defined resource.
 
     public void setName(String name) {
         this. = name;
     }
    
    
The name of the resource, such as CPU, MEMORY, PORTS, or a user-defined resource.

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

Parameters:
name The name of the resource, such as CPU, MEMORY, PORTS, or a user-defined resource.
Returns:
A reference to this updated object so that method calls can be chained together.
 
     public Resource withName(String name) {
         this. = name;
         return this;
     }

    
The type of the resource, such as INTEGER, DOUBLE, LONG, or STRINGSET.

Returns:
The type of the resource, such as INTEGER, DOUBLE, LONG, or STRINGSET.
    public String getType() {
        return ;
    }
    
    
The type of the resource, such as INTEGER, DOUBLE, LONG, or STRINGSET.

Parameters:
type The type of the resource, such as INTEGER, DOUBLE, LONG, or STRINGSET.
    public void setType(String type) {
        this. = type;
    }
    
    
The type of the resource, such as INTEGER, DOUBLE, LONG, or STRINGSET.

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

Parameters:
type The type of the resource, such as INTEGER, DOUBLE, LONG, or STRINGSET.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Resource withType(String type) {
        this. = type;
        return this;
    }

    
When the doubleValue type is set, the value of the resource must be a double precision floating-point type.

Returns:
When the doubleValue type is set, the value of the resource must be a double precision floating-point type.
    public Double getDoubleValue() {
        return ;
    }
    
    
When the doubleValue type is set, the value of the resource must be a double precision floating-point type.

Parameters:
doubleValue When the doubleValue type is set, the value of the resource must be a double precision floating-point type.
    public void setDoubleValue(Double doubleValue) {
        this. = doubleValue;
    }
    
    
When the doubleValue type is set, the value of the resource must be a double precision floating-point type.

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

Parameters:
doubleValue When the doubleValue type is set, the value of the resource must be a double precision floating-point type.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Resource withDoubleValue(Double doubleValue) {
        this. = doubleValue;
        return this;
    }

    
When the longValue type is set, the value of the resource must be an extended precision floating-point type.

Returns:
When the longValue type is set, the value of the resource must be an extended precision floating-point type.
    public Long getLongValue() {
        return ;
    }
    
    
When the longValue type is set, the value of the resource must be an extended precision floating-point type.

Parameters:
longValue When the longValue type is set, the value of the resource must be an extended precision floating-point type.
    public void setLongValue(Long longValue) {
        this. = longValue;
    }
    
    
When the longValue type is set, the value of the resource must be an extended precision floating-point type.

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

Parameters:
longValue When the longValue type is set, the value of the resource must be an extended precision floating-point type.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Resource withLongValue(Long longValue) {
        this. = longValue;
        return this;
    }

    
When the integerValue type is set, the value of the resource must be an integer.

Returns:
When the integerValue type is set, the value of the resource must be an integer.
    public Integer getIntegerValue() {
        return ;
    }
    
    
When the integerValue type is set, the value of the resource must be an integer.

Parameters:
integerValue When the integerValue type is set, the value of the resource must be an integer.
    public void setIntegerValue(Integer integerValue) {
        this. = integerValue;
    }
    
    
When the integerValue type is set, the value of the resource must be an integer.

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

Parameters:
integerValue When the integerValue type is set, the value of the resource must be an integer.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Resource withIntegerValue(Integer integerValue) {
        this. = integerValue;
        return this;
    }

    
When the stringSetValue type is set, the value of the resource must be a string type.

Returns:
When the stringSetValue type is set, the value of the resource must be a string type.
    public java.util.List<StringgetStringSetValue() {
        if ( == null) {
               = new com.amazonaws.internal.ListWithAutoConstructFlag<String>();
              .setAutoConstruct(true);
        }
        return ;
    }
    
    
When the stringSetValue type is set, the value of the resource must be a string type.

Parameters:
stringSetValue When the stringSetValue type is set, the value of the resource must be a string type.
    public void setStringSetValue(java.util.Collection<StringstringSetValue) {
        if (stringSetValue == null) {
            this. = null;
            return;
        }
        com.amazonaws.internal.ListWithAutoConstructFlag<StringstringSetValueCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<String>(stringSetValue.size());
        stringSetValueCopy.addAll(stringSetValue);
        this. = stringSetValueCopy;
    }
    
    
When the stringSetValue type is set, the value of the resource must be a string type.

NOTE: This method appends the values to the existing list (if any). Use setStringSetValue(java.util.Collection) or withStringSetValue(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:
stringSetValue When the stringSetValue type is set, the value of the resource must be a string type.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Resource withStringSetValue(String... stringSetValue) {
        if (getStringSetValue() == nullsetStringSetValue(new java.util.ArrayList<String>(stringSetValue.length));
        for (String value : stringSetValue) {
            getStringSetValue().add(value);
        }
        return this;
    }
    
    
When the stringSetValue type is set, the value of the resource must be a string type.

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

Parameters:
stringSetValue When the stringSetValue type is set, the value of the resource must be a string type.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Resource withStringSetValue(java.util.Collection<StringstringSetValue) {
        if (stringSetValue == null) {
            this. = null;
        } else {
            com.amazonaws.internal.ListWithAutoConstructFlag<StringstringSetValueCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<String>(stringSetValue.size());
            stringSetValueCopy.addAll(stringSetValue);
            this. = stringSetValueCopy;
        }
        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 (getName() != nullsb.append("Name: " + getName() + ",");
        if (getType() != nullsb.append("Type: " + getType() + ",");
        if (getDoubleValue() != nullsb.append("DoubleValue: " + getDoubleValue() + ",");
        if (getLongValue() != nullsb.append("LongValue: " + getLongValue() + ",");
        if (getIntegerValue() != nullsb.append("IntegerValue: " + getIntegerValue() + ",");
        if (getStringSetValue() != nullsb.append("StringSetValue: " + getStringSetValue() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getName() == null) ? 0 : getName().hashCode()); 
        hashCode = prime * hashCode + ((getType() == null) ? 0 : getType().hashCode()); 
        hashCode = prime * hashCode + ((getDoubleValue() == null) ? 0 : getDoubleValue().hashCode()); 
        hashCode = prime * hashCode + ((getLongValue() == null) ? 0 : getLongValue().hashCode()); 
        hashCode = prime * hashCode + ((getIntegerValue() == null) ? 0 : getIntegerValue().hashCode()); 
        hashCode = prime * hashCode + ((getStringSetValue() == null) ? 0 : getStringSetValue().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof Resource == falsereturn false;
        Resource other = (Resource)obj;
        
        if (other.getName() == null ^ this.getName() == nullreturn false;
        if (other.getName() != null && other.getName().equals(this.getName()) == falsereturn false
        if (other.getType() == null ^ this.getType() == nullreturn false;
        if (other.getType() != null && other.getType().equals(this.getType()) == falsereturn false
        if (other.getDoubleValue() == null ^ this.getDoubleValue() == nullreturn false;
        if (other.getDoubleValue() != null && other.getDoubleValue().equals(this.getDoubleValue()) == falsereturn false
        if (other.getLongValue() == null ^ this.getLongValue() == nullreturn false;
        if (other.getLongValue() != null && other.getLongValue().equals(this.getLongValue()) == falsereturn false
        if (other.getIntegerValue() == null ^ this.getIntegerValue() == nullreturn false;
        if (other.getIntegerValue() != null && other.getIntegerValue().equals(this.getIntegerValue()) == falsereturn false
        if (other.getStringSetValue() == null ^ this.getStringSetValue() == nullreturn false;
        if (other.getStringSetValue() != null && other.getStringSetValue().equals(this.getStringSetValue()) == falsereturn false
        return true;
    }
    
    @Override
    public Resource clone() {
        try {
            return (Resourcesuper.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