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;
 
 
 public class Task implements SerializableCloneable {

    
The Amazon Resource Name (ARN) of the task.
 
     private String taskArn;

    
The Amazon Resource Name (ARN) of the of the cluster that hosts the task.
 
     private String clusterArn;

    
The Amazon Resource Name (ARN) of the of the task definition that creates the task.
 
     private String taskDefinitionArn;

    
The Amazon Resource Name (ARN) of the container instances that host the task.
 
     private String containerInstanceArn;

    
One or more container overrides.
 
     private TaskOverride overrides;

    
The last known status of the task.
 
     private String lastStatus;

    
The desired status of the task.
 
     private String desiredStatus;

    
The containers associated with the task.
 
 
     private String startedBy;

    
The Amazon Resource Name (ARN) of the task.

Returns:
The Amazon Resource Name (ARN) of the task.
 
     public String getTaskArn() {
         return ;
     }
    
    
The Amazon Resource Name (ARN) of the task.

Parameters:
taskArn The Amazon Resource Name (ARN) of the task.
 
     public void setTaskArn(String taskArn) {
         this. = taskArn;
     }
    
    
The Amazon Resource Name (ARN) of the task.

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

Parameters:
taskArn The Amazon Resource Name (ARN) of the task.
Returns:
A reference to this updated object so that method calls can be chained together.
 
    public Task withTaskArn(String taskArn) {
        this. = taskArn;
        return this;
    }

    
The Amazon Resource Name (ARN) of the of the cluster that hosts the task.

Returns:
The Amazon Resource Name (ARN) of the of the cluster that hosts the task.
    public String getClusterArn() {
        return ;
    }
    
    
The Amazon Resource Name (ARN) of the of the cluster that hosts the task.

Parameters:
clusterArn The Amazon Resource Name (ARN) of the of the cluster that hosts the task.
    public void setClusterArn(String clusterArn) {
        this. = clusterArn;
    }
    
    
The Amazon Resource Name (ARN) of the of the cluster that hosts the task.

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

Parameters:
clusterArn The Amazon Resource Name (ARN) of the of the cluster that hosts the task.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Task withClusterArn(String clusterArn) {
        this. = clusterArn;
        return this;
    }

    
The Amazon Resource Name (ARN) of the of the task definition that creates the task.

Returns:
The Amazon Resource Name (ARN) of the of the task definition that creates the task.
    public String getTaskDefinitionArn() {
        return ;
    }
    
    
The Amazon Resource Name (ARN) of the of the task definition that creates the task.

Parameters:
taskDefinitionArn The Amazon Resource Name (ARN) of the of the task definition that creates the task.
    public void setTaskDefinitionArn(String taskDefinitionArn) {
        this. = taskDefinitionArn;
    }
    
    
The Amazon Resource Name (ARN) of the of the task definition that creates the task.

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

Parameters:
taskDefinitionArn The Amazon Resource Name (ARN) of the of the task definition that creates the task.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Task withTaskDefinitionArn(String taskDefinitionArn) {
        this. = taskDefinitionArn;
        return this;
    }

    
The Amazon Resource Name (ARN) of the container instances that host the task.

Returns:
The Amazon Resource Name (ARN) of the container instances that host the task.
    public String getContainerInstanceArn() {
        return ;
    }
    
    
The Amazon Resource Name (ARN) of the container instances that host the task.

Parameters:
containerInstanceArn The Amazon Resource Name (ARN) of the container instances that host the task.
    public void setContainerInstanceArn(String containerInstanceArn) {
        this. = containerInstanceArn;
    }
    
    
The Amazon Resource Name (ARN) of the container instances that host the task.

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

Parameters:
containerInstanceArn The Amazon Resource Name (ARN) of the container instances that host the task.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Task withContainerInstanceArn(String containerInstanceArn) {
        this. = containerInstanceArn;
        return this;
    }

    
One or more container overrides.

Returns:
One or more container overrides.
    public TaskOverride getOverrides() {
        return ;
    }
    
    
One or more container overrides.

Parameters:
overrides One or more container overrides.
    public void setOverrides(TaskOverride overrides) {
        this. = overrides;
    }
    
    
One or more container overrides.

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

Parameters:
overrides One or more container overrides.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Task withOverrides(TaskOverride overrides) {
        this. = overrides;
        return this;
    }

    
The last known status of the task.

Returns:
The last known status of the task.
    public String getLastStatus() {
        return ;
    }
    
    
The last known status of the task.

Parameters:
lastStatus The last known status of the task.
    public void setLastStatus(String lastStatus) {
        this. = lastStatus;
    }
    
    
The last known status of the task.

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

Parameters:
lastStatus The last known status of the task.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Task withLastStatus(String lastStatus) {
        this. = lastStatus;
        return this;
    }

    
The desired status of the task.

Returns:
The desired status of the task.
    public String getDesiredStatus() {
        return ;
    }
    
    
The desired status of the task.

Parameters:
desiredStatus The desired status of the task.
    public void setDesiredStatus(String desiredStatus) {
        this. = desiredStatus;
    }
    
    
The desired status of the task.

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

Parameters:
desiredStatus The desired status of the task.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Task withDesiredStatus(String desiredStatus) {
        this. = desiredStatus;
        return this;
    }

    
The containers associated with the task.

Returns:
The containers associated with the task.
    public java.util.List<ContainergetContainers() {
        if ( == null) {
               = new com.amazonaws.internal.ListWithAutoConstructFlag<Container>();
              .setAutoConstruct(true);
        }
        return ;
    }
    
    
The containers associated with the task.

Parameters:
containers The containers associated with the task.
    public void setContainers(java.util.Collection<Containercontainers) {
        if (containers == null) {
            this. = null;
            return;
        }
        containersCopy.addAll(containers);
        this. = containersCopy;
    }
    
    
The containers associated with the task.

NOTE: This method appends the values to the existing list (if any). Use setContainers(java.util.Collection) or withContainers(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:
containers The containers associated with the task.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Task withContainers(Container... containers) {
        if (getContainers() == nullsetContainers(new java.util.ArrayList<Container>(containers.length));
        for (Container value : containers) {
            getContainers().add(value);
        }
        return this;
    }
    
    
The containers associated with the task.

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

Parameters:
containers The containers associated with the task.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Task withContainers(java.util.Collection<Containercontainers) {
        if (containers == null) {
            this. = null;
        } else {
            containersCopy.addAll(containers);
            this. = containersCopy;
        }
        return this;
    }

    

Returns:
    public String getStartedBy() {
        return ;
    }
    
    

Parameters:
startedBy
    public void setStartedBy(String startedBy) {
        this. = startedBy;
    }
    
    

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

Parameters:
startedBy
Returns:
A reference to this updated object so that method calls can be chained together.
    public Task withStartedBy(String startedBy) {
        this. = startedBy;
        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 (getTaskArn() != nullsb.append("TaskArn: " + getTaskArn() + ",");
        if (getClusterArn() != nullsb.append("ClusterArn: " + getClusterArn() + ",");
        if (getTaskDefinitionArn() != nullsb.append("TaskDefinitionArn: " + getTaskDefinitionArn() + ",");
        if (getContainerInstanceArn() != nullsb.append("ContainerInstanceArn: " + getContainerInstanceArn() + ",");
        if (getOverrides() != nullsb.append("Overrides: " + getOverrides() + ",");
        if (getLastStatus() != nullsb.append("LastStatus: " + getLastStatus() + ",");
        if (getDesiredStatus() != nullsb.append("DesiredStatus: " + getDesiredStatus() + ",");
        if (getContainers() != nullsb.append("Containers: " + getContainers() + ",");
        if (getStartedBy() != nullsb.append("StartedBy: " + getStartedBy() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getTaskArn() == null) ? 0 : getTaskArn().hashCode()); 
        hashCode = prime * hashCode + ((getClusterArn() == null) ? 0 : getClusterArn().hashCode()); 
        hashCode = prime * hashCode + ((getTaskDefinitionArn() == null) ? 0 : getTaskDefinitionArn().hashCode()); 
        hashCode = prime * hashCode + ((getContainerInstanceArn() == null) ? 0 : getContainerInstanceArn().hashCode()); 
        hashCode = prime * hashCode + ((getOverrides() == null) ? 0 : getOverrides().hashCode()); 
        hashCode = prime * hashCode + ((getLastStatus() == null) ? 0 : getLastStatus().hashCode()); 
        hashCode = prime * hashCode + ((getDesiredStatus() == null) ? 0 : getDesiredStatus().hashCode()); 
        hashCode = prime * hashCode + ((getContainers() == null) ? 0 : getContainers().hashCode()); 
        hashCode = prime * hashCode + ((getStartedBy() == null) ? 0 : getStartedBy().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof Task == falsereturn false;
        Task other = (Task)obj;
        
        if (other.getTaskArn() == null ^ this.getTaskArn() == nullreturn false;
        if (other.getTaskArn() != null && other.getTaskArn().equals(this.getTaskArn()) == falsereturn false
        if (other.getClusterArn() == null ^ this.getClusterArn() == nullreturn false;
        if (other.getClusterArn() != null && other.getClusterArn().equals(this.getClusterArn()) == falsereturn false
        if (other.getTaskDefinitionArn() == null ^ this.getTaskDefinitionArn() == nullreturn false;
        if (other.getTaskDefinitionArn() != null && other.getTaskDefinitionArn().equals(this.getTaskDefinitionArn()) == falsereturn false
        if (other.getContainerInstanceArn() == null ^ this.getContainerInstanceArn() == nullreturn false;
        if (other.getContainerInstanceArn() != null && other.getContainerInstanceArn().equals(this.getContainerInstanceArn()) == falsereturn false
        if (other.getOverrides() == null ^ this.getOverrides() == nullreturn false;
        if (other.getOverrides() != null && other.getOverrides().equals(this.getOverrides()) == falsereturn false
        if (other.getLastStatus() == null ^ this.getLastStatus() == nullreturn false;
        if (other.getLastStatus() != null && other.getLastStatus().equals(this.getLastStatus()) == falsereturn false
        if (other.getDesiredStatus() == null ^ this.getDesiredStatus() == nullreturn false;
        if (other.getDesiredStatus() != null && other.getDesiredStatus().equals(this.getDesiredStatus()) == falsereturn false
        if (other.getContainers() == null ^ this.getContainers() == nullreturn false;
        if (other.getContainers() != null && other.getContainers().equals(this.getContainers()) == falsereturn false
        if (other.getStartedBy() == null ^ this.getStartedBy() == nullreturn false;
        if (other.getStartedBy() != null && other.getStartedBy().equals(this.getStartedBy()) == falsereturn false
        return true;
    }
    
    @Override
    public Task clone() {
        try {
            return (Tasksuper.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