コード例 #1
0
  @Override
  public boolean equals(Object obj) {
    if (this == obj) return true;
    if (obj == null) return false;

    if (obj instanceof TaskDefinition == false) return false;
    TaskDefinition other = (TaskDefinition) obj;
    if (other.getTaskDefinitionArn() == null ^ this.getTaskDefinitionArn() == null) return false;
    if (other.getTaskDefinitionArn() != null
        && other.getTaskDefinitionArn().equals(this.getTaskDefinitionArn()) == false) return false;
    if (other.getContainerDefinitions() == null ^ this.getContainerDefinitions() == null)
      return false;
    if (other.getContainerDefinitions() != null
        && other.getContainerDefinitions().equals(this.getContainerDefinitions()) == false)
      return false;
    if (other.getFamily() == null ^ this.getFamily() == null) return false;
    if (other.getFamily() != null && other.getFamily().equals(this.getFamily()) == false)
      return false;
    if (other.getTaskRoleArn() == null ^ this.getTaskRoleArn() == null) return false;
    if (other.getTaskRoleArn() != null
        && other.getTaskRoleArn().equals(this.getTaskRoleArn()) == false) return false;
    if (other.getNetworkMode() == null ^ this.getNetworkMode() == null) return false;
    if (other.getNetworkMode() != null
        && other.getNetworkMode().equals(this.getNetworkMode()) == false) return false;
    if (other.getRevision() == null ^ this.getRevision() == null) return false;
    if (other.getRevision() != null && other.getRevision().equals(this.getRevision()) == false)
      return false;
    if (other.getVolumes() == null ^ this.getVolumes() == null) return false;
    if (other.getVolumes() != null && other.getVolumes().equals(this.getVolumes()) == false)
      return false;
    if (other.getStatus() == null ^ this.getStatus() == null) return false;
    if (other.getStatus() != null && other.getStatus().equals(this.getStatus()) == false)
      return false;
    if (other.getRequiresAttributes() == null ^ this.getRequiresAttributes() == null) return false;
    if (other.getRequiresAttributes() != null
        && other.getRequiresAttributes().equals(this.getRequiresAttributes()) == false)
      return false;
    return true;
  }
コード例 #2
0
  /** Marshall the given parameter object, and output to a JSONWriter */
  public void marshall(TaskDefinition taskDefinition, JSONWriter jsonWriter) {
    if (taskDefinition == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    try {
      jsonWriter.object();

      if (taskDefinition.getTaskDefinitionArn() != null) {
        jsonWriter.key("taskDefinitionArn").value(taskDefinition.getTaskDefinitionArn());
      }

      com.amazonaws.internal.SdkInternalList<ContainerDefinition> containerDefinitionsList =
          (com.amazonaws.internal.SdkInternalList<ContainerDefinition>)
              taskDefinition.getContainerDefinitions();
      if (!containerDefinitionsList.isEmpty() || !containerDefinitionsList.isAutoConstruct()) {
        jsonWriter.key("containerDefinitions");
        jsonWriter.array();
        for (ContainerDefinition containerDefinitionsListValue : containerDefinitionsList) {
          if (containerDefinitionsListValue != null) {

            ContainerDefinitionJsonMarshaller.getInstance()
                .marshall(containerDefinitionsListValue, jsonWriter);
          }
        }
        jsonWriter.endArray();
      }

      if (taskDefinition.getFamily() != null) {
        jsonWriter.key("family").value(taskDefinition.getFamily());
      }

      if (taskDefinition.getRevision() != null) {
        jsonWriter.key("revision").value(taskDefinition.getRevision());
      }

      com.amazonaws.internal.SdkInternalList<Volume> volumesList =
          (com.amazonaws.internal.SdkInternalList<Volume>) taskDefinition.getVolumes();
      if (!volumesList.isEmpty() || !volumesList.isAutoConstruct()) {
        jsonWriter.key("volumes");
        jsonWriter.array();
        for (Volume volumesListValue : volumesList) {
          if (volumesListValue != null) {

            VolumeJsonMarshaller.getInstance().marshall(volumesListValue, jsonWriter);
          }
        }
        jsonWriter.endArray();
      }

      if (taskDefinition.getStatus() != null) {
        jsonWriter.key("status").value(taskDefinition.getStatus());
      }

      com.amazonaws.internal.SdkInternalList<Attribute> requiresAttributesList =
          (com.amazonaws.internal.SdkInternalList<Attribute>)
              taskDefinition.getRequiresAttributes();
      if (!requiresAttributesList.isEmpty() || !requiresAttributesList.isAutoConstruct()) {
        jsonWriter.key("requiresAttributes");
        jsonWriter.array();
        for (Attribute requiresAttributesListValue : requiresAttributesList) {
          if (requiresAttributesListValue != null) {

            AttributeJsonMarshaller.getInstance().marshall(requiresAttributesListValue, jsonWriter);
          }
        }
        jsonWriter.endArray();
      }

      jsonWriter.endObject();
    } catch (Throwable t) {
      throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }
  }