public Request<RespondDecisionTaskCompletedRequest> marshall(
      RespondDecisionTaskCompletedRequest respondDecisionTaskCompletedRequest) {

    if (respondDecisionTaskCompletedRequest == null) {
      throw new SdkClientException("Invalid argument passed to marshall(...)");
    }

    Request<RespondDecisionTaskCompletedRequest> request =
        new DefaultRequest<RespondDecisionTaskCompletedRequest>(
            respondDecisionTaskCompletedRequest, "AmazonSimpleWorkflow");
    request.addHeader("X-Amz-Target", "SimpleWorkflowService.RespondDecisionTaskCompleted");

    request.setHttpMethod(HttpMethodName.POST);

    request.setResourcePath("");

    try {
      final StructuredJsonGenerator jsonGenerator = protocolFactory.createGenerator();

      jsonGenerator.writeStartObject();

      if (respondDecisionTaskCompletedRequest.getTaskToken() != null) {
        jsonGenerator
            .writeFieldName("taskToken")
            .writeValue(respondDecisionTaskCompletedRequest.getTaskToken());
      }

      java.util.List<Decision> decisionsList = respondDecisionTaskCompletedRequest.getDecisions();
      if (decisionsList != null) {
        jsonGenerator.writeFieldName("decisions");
        jsonGenerator.writeStartArray();
        for (Decision decisionsListValue : decisionsList) {
          if (decisionsListValue != null) {

            DecisionJsonMarshaller.getInstance().marshall(decisionsListValue, jsonGenerator);
          }
        }
        jsonGenerator.writeEndArray();
      }
      if (respondDecisionTaskCompletedRequest.getExecutionContext() != null) {
        jsonGenerator
            .writeFieldName("executionContext")
            .writeValue(respondDecisionTaskCompletedRequest.getExecutionContext());
      }

      jsonGenerator.writeEndObject();

      byte[] content = jsonGenerator.getBytes();
      request.setContent(new ByteArrayInputStream(content));
      request.addHeader("Content-Length", Integer.toString(content.length));
      request.addHeader("Content-Type", protocolFactory.getContentType());
    } catch (Throwable t) {
      throw new SdkClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }

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

    if (obj instanceof RespondDecisionTaskCompletedRequest == false) return false;
    RespondDecisionTaskCompletedRequest other = (RespondDecisionTaskCompletedRequest) obj;

    if (other.getTaskToken() == null ^ this.getTaskToken() == null) return false;
    if (other.getTaskToken() != null && other.getTaskToken().equals(this.getTaskToken()) == false)
      return false;
    if (other.getDecisions() == null ^ this.getDecisions() == null) return false;
    if (other.getDecisions() != null && other.getDecisions().equals(this.getDecisions()) == false)
      return false;
    if (other.getExecutionContext() == null ^ this.getExecutionContext() == null) return false;
    if (other.getExecutionContext() != null
        && other.getExecutionContext().equals(this.getExecutionContext()) == false) return false;
    return true;
  }