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

    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("name", targetDepth)) {
          context.nextToken();
          actionContext.setName(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 actionContext;
  }
  public ActionTypeSettings unmarshall(JsonUnmarshallerContext context) throws Exception {
    ActionTypeSettings actionTypeSettings = new ActionTypeSettings();

    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("thirdPartyConfigurationUrl", targetDepth)) {
          context.nextToken();
          actionTypeSettings.setThirdPartyConfigurationUrl(
              context.getUnmarshaller(String.class).unmarshall(context));
        }
        if (context.testExpression("entityUrlTemplate", targetDepth)) {
          context.nextToken();
          actionTypeSettings.setEntityUrlTemplate(
              context.getUnmarshaller(String.class).unmarshall(context));
        }
        if (context.testExpression("executionUrlTemplate", targetDepth)) {
          context.nextToken();
          actionTypeSettings.setExecutionUrlTemplate(
              context.getUnmarshaller(String.class).unmarshall(context));
        }
        if (context.testExpression("revisionUrlTemplate", targetDepth)) {
          context.nextToken();
          actionTypeSettings.setRevisionUrlTemplate(
              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 actionTypeSettings;
  }
コード例 #3
0
  public PipelineSummary unmarshall(JsonUnmarshallerContext context) throws Exception {
    PipelineSummary pipelineSummary = new PipelineSummary();

    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("name", targetDepth)) {
          context.nextToken();
          pipelineSummary.setName(context.getUnmarshaller(String.class).unmarshall(context));
        }
        if (context.testExpression("version", targetDepth)) {
          context.nextToken();
          pipelineSummary.setVersion(context.getUnmarshaller(Integer.class).unmarshall(context));
        }
        if (context.testExpression("created", targetDepth)) {
          context.nextToken();
          pipelineSummary.setCreated(
              context.getUnmarshaller(java.util.Date.class).unmarshall(context));
        }
        if (context.testExpression("updated", targetDepth)) {
          context.nextToken();
          pipelineSummary.setUpdated(
              context.getUnmarshaller(java.util.Date.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 pipelineSummary;
  }