public GlobalSecondaryIndexUpdate unmarshall(JsonUnmarshallerContext context) throws Exception {
    GlobalSecondaryIndexUpdate globalSecondaryIndexUpdate = new GlobalSecondaryIndexUpdate();

    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("Update", targetDepth)) {
          context.nextToken();
          globalSecondaryIndexUpdate.setUpdate(
              UpdateGlobalSecondaryIndexActionJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("Create", targetDepth)) {
          context.nextToken();
          globalSecondaryIndexUpdate.setCreate(
              CreateGlobalSecondaryIndexActionJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("Delete", targetDepth)) {
          context.nextToken();
          globalSecondaryIndexUpdate.setDelete(
              DeleteGlobalSecondaryIndexActionJsonUnmarshaller.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 globalSecondaryIndexUpdate;
  }
コード例 #2
0
 /**
  * The name of an existing global secondary index, along with new provisioned throughput settings
  * to be applied to that index.
  *
  * @param update The name of an existing global secondary index, along with new provisioned
  *     throughput settings to be applied to that index.
  * @return Returns a reference to this object so that method calls can be chained together.
  */
 public GlobalSecondaryIndexUpdate withUpdate(UpdateGlobalSecondaryIndexAction update) {
   setUpdate(update);
   return this;
 }