コード例 #1
0
  public SnsAction unmarshall(JsonUnmarshallerContext context) throws Exception {
    SnsAction snsAction = new SnsAction();

    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("targetArn", targetDepth)) {
          context.nextToken();
          snsAction.setTargetArn(context.getUnmarshaller(String.class).unmarshall(context));
        }
        if (context.testExpression("roleArn", targetDepth)) {
          context.nextToken();
          snsAction.setRoleArn(context.getUnmarshaller(String.class).unmarshall(context));
        }
        if (context.testExpression("messageFormat", targetDepth)) {
          context.nextToken();
          snsAction.setMessageFormat(context.getUnmarshaller(String.class).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 snsAction;
  }
  public CreateThingTypeResult unmarshall(JsonUnmarshallerContext context) throws Exception {
    CreateThingTypeResult createThingTypeResult = new CreateThingTypeResult();

    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("thingTypeName", targetDepth)) {
          context.nextToken();
          createThingTypeResult.setThingTypeName(
              context.getUnmarshaller(String.class).unmarshall(context));
        }
        if (context.testExpression("thingTypeArn", targetDepth)) {
          context.nextToken();
          createThingTypeResult.setThingTypeArn(
              context.getUnmarshaller(String.class).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 createThingTypeResult;
  }
  public ListPoliciesResult unmarshall(JsonUnmarshallerContext context) throws Exception {
    ListPoliciesResult listPoliciesResult = new ListPoliciesResult();

    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("policies", targetDepth)) {
          context.nextToken();
          listPoliciesResult.setPolicies(
              new ListUnmarshaller<Policy>(PolicyJsonUnmarshaller.getInstance())
                  .unmarshall(context));
        }
        if (context.testExpression("nextMarker", targetDepth)) {
          context.nextToken();
          listPoliciesResult.setNextMarker(
              context.getUnmarshaller(String.class).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 listPoliciesResult;
  }