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;
  }
Exemplo n.º 2
0
 /**
  * The name of the pipeline.
  *
  * @param name The name of the pipeline.
  * @return Returns a reference to this object so that method calls can be chained together.
  */
 public PipelineSummary withName(String name) {
   setName(name);
   return this;
 }