public AutoScalingThresholds unmarshall(JsonUnmarshallerContext context) throws Exception {
    AutoScalingThresholds autoScalingThresholds = new AutoScalingThresholds();

    int originalDepth = context.getCurrentDepth();
    String currentParentElement = context.getCurrentParentElement();
    int targetDepth = originalDepth + 1;

    JsonToken token = context.currentToken;
    if (token == null) token = context.nextToken();

    while (true) {
      if (token == null) break;

      if (token == FIELD_NAME || token == START_OBJECT) {
        if (context.testExpression("InstanceCount", targetDepth)) {
          context.nextToken();
          autoScalingThresholds.setInstanceCount(
              IntegerJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("ThresholdsWaitTime", targetDepth)) {
          context.nextToken();
          autoScalingThresholds.setThresholdsWaitTime(
              IntegerJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("IgnoreMetricsTime", targetDepth)) {
          context.nextToken();
          autoScalingThresholds.setIgnoreMetricsTime(
              IntegerJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("CpuThreshold", targetDepth)) {
          context.nextToken();
          autoScalingThresholds.setCpuThreshold(
              DoubleJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("MemoryThreshold", targetDepth)) {
          context.nextToken();
          autoScalingThresholds.setMemoryThreshold(
              DoubleJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("LoadThreshold", targetDepth)) {
          context.nextToken();
          autoScalingThresholds.setLoadThreshold(
              DoubleJsonUnmarshaller.getInstance().unmarshall(context));
        }
      } else if (token == END_ARRAY || token == END_OBJECT) {
        if (context.getLastParsedParentElement() == null
            || context.getLastParsedParentElement().equals(currentParentElement)) {
          if (context.getCurrentDepth() <= originalDepth) break;
        }
      }

      token = context.nextToken();
    }

    return autoScalingThresholds;
  }
  @Override
  public boolean equals(Object obj) {
    if (this == obj) return true;
    if (obj == null) return false;

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

    if (other.getInstanceCount() == null ^ this.getInstanceCount() == null) return false;
    if (other.getInstanceCount() != null
        && other.getInstanceCount().equals(this.getInstanceCount()) == false) return false;
    if (other.getThresholdsWaitTime() == null ^ this.getThresholdsWaitTime() == null) return false;
    if (other.getThresholdsWaitTime() != null
        && other.getThresholdsWaitTime().equals(this.getThresholdsWaitTime()) == false)
      return false;
    if (other.getIgnoreMetricsTime() == null ^ this.getIgnoreMetricsTime() == null) return false;
    if (other.getIgnoreMetricsTime() != null
        && other.getIgnoreMetricsTime().equals(this.getIgnoreMetricsTime()) == false) return false;
    if (other.getCpuThreshold() == null ^ this.getCpuThreshold() == null) return false;
    if (other.getCpuThreshold() != null
        && other.getCpuThreshold().equals(this.getCpuThreshold()) == false) return false;
    if (other.getMemoryThreshold() == null ^ this.getMemoryThreshold() == null) return false;
    if (other.getMemoryThreshold() != null
        && other.getMemoryThreshold().equals(this.getMemoryThreshold()) == false) return false;
    if (other.getLoadThreshold() == null ^ this.getLoadThreshold() == null) return false;
    if (other.getLoadThreshold() != null
        && other.getLoadThreshold().equals(this.getLoadThreshold()) == false) return false;
    return true;
  }
  /** Marshall the given parameter object, and output to a SdkJsonGenerator */
  public void marshall(
      AutoScalingThresholds autoScalingThresholds, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (autoScalingThresholds.getInstanceCount() != null) {
        jsonGenerator
            .writeFieldName("InstanceCount")
            .writeValue(autoScalingThresholds.getInstanceCount());
      }
      if (autoScalingThresholds.getThresholdsWaitTime() != null) {
        jsonGenerator
            .writeFieldName("ThresholdsWaitTime")
            .writeValue(autoScalingThresholds.getThresholdsWaitTime());
      }
      if (autoScalingThresholds.getIgnoreMetricsTime() != null) {
        jsonGenerator
            .writeFieldName("IgnoreMetricsTime")
            .writeValue(autoScalingThresholds.getIgnoreMetricsTime());
      }
      if (autoScalingThresholds.getCpuThreshold() != null) {
        jsonGenerator
            .writeFieldName("CpuThreshold")
            .writeValue(autoScalingThresholds.getCpuThreshold());
      }
      if (autoScalingThresholds.getMemoryThreshold() != null) {
        jsonGenerator
            .writeFieldName("MemoryThreshold")
            .writeValue(autoScalingThresholds.getMemoryThreshold());
      }
      if (autoScalingThresholds.getLoadThreshold() != null) {
        jsonGenerator
            .writeFieldName("LoadThreshold")
            .writeValue(autoScalingThresholds.getLoadThreshold());
      }

      com.amazonaws.internal.SdkInternalList<String> alarmsList =
          (com.amazonaws.internal.SdkInternalList<String>) autoScalingThresholds.getAlarms();
      if (!alarmsList.isEmpty() || !alarmsList.isAutoConstruct()) {
        jsonGenerator.writeFieldName("Alarms");
        jsonGenerator.writeStartArray();
        for (String alarmsListValue : alarmsList) {
          if (alarmsListValue != null) {
            jsonGenerator.writeValue(alarmsListValue);
          }
        }
        jsonGenerator.writeEndArray();
      }

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