コード例 #1
0
  /** Marshall the given parameter object, and output to a JSONWriter */
  public void marshall(Service service, JSONWriter jsonWriter) {
    if (service == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    try {
      jsonWriter.object();

      if (service.getCode() != null) {
        jsonWriter.key("code").value(service.getCode());
      }

      if (service.getName() != null) {
        jsonWriter.key("name").value(service.getName());
      }

      com.amazonaws.internal.SdkInternalList<Category> categoriesList =
          (com.amazonaws.internal.SdkInternalList<Category>) service.getCategories();
      if (!categoriesList.isEmpty() || !categoriesList.isAutoConstruct()) {
        jsonWriter.key("categories");
        jsonWriter.array();
        for (Category categoriesListValue : categoriesList) {
          if (categoriesListValue != null) {

            CategoryJsonMarshaller.getInstance().marshall(categoriesListValue, jsonWriter);
          }
        }
        jsonWriter.endArray();
      }

      jsonWriter.endObject();
    } catch (Throwable t) {
      throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }
  }
  /** Marshall the given parameter object, and output to a JSONWriter */
  public void marshall(TrustedAdvisorCheckResult trustedAdvisorCheckResult, JSONWriter jsonWriter) {
    if (trustedAdvisorCheckResult == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    try {
      jsonWriter.object();

      if (trustedAdvisorCheckResult.getCheckId() != null) {
        jsonWriter.key("checkId").value(trustedAdvisorCheckResult.getCheckId());
      }

      if (trustedAdvisorCheckResult.getTimestamp() != null) {
        jsonWriter.key("timestamp").value(trustedAdvisorCheckResult.getTimestamp());
      }

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

      if (trustedAdvisorCheckResult.getResourcesSummary() != null) {
        jsonWriter.key("resourcesSummary");
        TrustedAdvisorResourcesSummaryJsonMarshaller.getInstance()
            .marshall(trustedAdvisorCheckResult.getResourcesSummary(), jsonWriter);
      }

      if (trustedAdvisorCheckResult.getCategorySpecificSummary() != null) {
        jsonWriter.key("categorySpecificSummary");
        TrustedAdvisorCategorySpecificSummaryJsonMarshaller.getInstance()
            .marshall(trustedAdvisorCheckResult.getCategorySpecificSummary(), jsonWriter);
      }

      com.amazonaws.internal.SdkInternalList<TrustedAdvisorResourceDetail> flaggedResourcesList =
          (com.amazonaws.internal.SdkInternalList<TrustedAdvisorResourceDetail>)
              trustedAdvisorCheckResult.getFlaggedResources();
      if (!flaggedResourcesList.isEmpty() || !flaggedResourcesList.isAutoConstruct()) {
        jsonWriter.key("flaggedResources");
        jsonWriter.array();
        for (TrustedAdvisorResourceDetail flaggedResourcesListValue : flaggedResourcesList) {
          if (flaggedResourcesListValue != null) {

            TrustedAdvisorResourceDetailJsonMarshaller.getInstance()
                .marshall(flaggedResourcesListValue, jsonWriter);
          }
        }
        jsonWriter.endArray();
      }

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