public IncompatibilityMessage unmarshall(JsonUnmarshallerContext context) throws Exception {
    IncompatibilityMessage incompatibilityMessage = new IncompatibilityMessage();

    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("message", targetDepth)) {
          context.nextToken();
          incompatibilityMessage.setMessage(
              StringJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("type", targetDepth)) {
          context.nextToken();
          incompatibilityMessage.setType(StringJsonUnmarshaller.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 incompatibilityMessage;
  }
コード例 #2
0
  public ListRunsResult unmarshall(JsonUnmarshallerContext context) throws Exception {
    ListRunsResult listRunsResult = new ListRunsResult();

    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("runs", targetDepth)) {
          context.nextToken();
          listRunsResult.setRuns(
              new ListUnmarshaller<Run>(RunJsonUnmarshaller.getInstance()).unmarshall(context));
        }
        if (context.testExpression("nextToken", targetDepth)) {
          context.nextToken();
          listRunsResult.setNextToken(StringJsonUnmarshaller.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 listRunsResult;
  }
コード例 #3
0
  public DevicePool unmarshall(JsonUnmarshallerContext context) throws Exception {
    DevicePool devicePool = new DevicePool();

    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("arn", targetDepth)) {
          context.nextToken();
          devicePool.setArn(StringJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("name", targetDepth)) {
          context.nextToken();
          devicePool.setName(StringJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("description", targetDepth)) {
          context.nextToken();
          devicePool.setDescription(StringJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("type", targetDepth)) {
          context.nextToken();
          devicePool.setType(StringJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("rules", targetDepth)) {
          context.nextToken();
          devicePool.setRules(
              new ListUnmarshaller<Rule>(RuleJsonUnmarshaller.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 devicePool;
  }