/** Marshall the given parameter object, and output to a SdkJsonGenerator */
  public void marshall(MetricFilter metricFilter, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (metricFilter.getFilterName() != null) {
        jsonGenerator.writeFieldName("filterName").writeValue(metricFilter.getFilterName());
      }
      if (metricFilter.getFilterPattern() != null) {
        jsonGenerator.writeFieldName("filterPattern").writeValue(metricFilter.getFilterPattern());
      }

      com.amazonaws.internal.SdkInternalList<MetricTransformation> metricTransformationsList =
          (com.amazonaws.internal.SdkInternalList<MetricTransformation>)
              metricFilter.getMetricTransformations();
      if (!metricTransformationsList.isEmpty() || !metricTransformationsList.isAutoConstruct()) {
        jsonGenerator.writeFieldName("metricTransformations");
        jsonGenerator.writeStartArray();
        for (MetricTransformation metricTransformationsListValue : metricTransformationsList) {
          if (metricTransformationsListValue != null) {

            MetricTransformationJsonMarshaller.getInstance()
                .marshall(metricTransformationsListValue, jsonGenerator);
          }
        }
        jsonGenerator.writeEndArray();
      }
      if (metricFilter.getCreationTime() != null) {
        jsonGenerator.writeFieldName("creationTime").writeValue(metricFilter.getCreationTime());
      }

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