public Capacity unmarshall(JsonUnmarshallerContext context) throws Exception {
    Capacity capacity = new Capacity();

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

    JsonToken token = context.getCurrentToken();
    if (token == null) token = context.nextToken();
    if (token == VALUE_NULL) return null;

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

      if (token == FIELD_NAME || token == START_OBJECT) {
        if (context.testExpression("CapacityUnits", targetDepth)) {
          context.nextToken();
          capacity.setCapacityUnits(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 capacity;
  }
  public ItemCollectionMetrics unmarshall(JsonUnmarshallerContext context) throws Exception {
    ItemCollectionMetrics itemCollectionMetrics = new ItemCollectionMetrics();

    AwsJsonReader reader = context.getReader();
    reader.beginObject();
    while (reader.hasNext()) {
      String name = reader.nextName();

      if (name.equals("ItemCollectionKey")) {
        itemCollectionMetrics.setItemCollectionKey(
            new MapUnmarshaller<AttributeValue>(AttributeValueJsonUnmarshaller.getInstance())
                .unmarshall(context));
      } else if (name.equals("SizeEstimateRangeGB")) {
        itemCollectionMetrics.setSizeEstimateRangeGB(
            new ListUnmarshaller<Double>(DoubleJsonUnmarshaller.getInstance()).unmarshall(context));
      } else {
        reader.skipValue();
      }
    }
    reader.endObject();

    return itemCollectionMetrics;
  }