/** Marshall the given parameter object, and output to a SdkJsonGenerator */
  public void marshall(PipelineSummary pipelineSummary, StructuredJsonGenerator jsonGenerator) {

    if (pipelineSummary == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    try {
      jsonGenerator.writeStartObject();

      if (pipelineSummary.getName() != null) {
        jsonGenerator.writeFieldName("name").writeValue(pipelineSummary.getName());
      }
      if (pipelineSummary.getVersion() != null) {
        jsonGenerator.writeFieldName("version").writeValue(pipelineSummary.getVersion());
      }
      if (pipelineSummary.getCreated() != null) {
        jsonGenerator.writeFieldName("created").writeValue(pipelineSummary.getCreated());
      }
      if (pipelineSummary.getUpdated() != null) {
        jsonGenerator.writeFieldName("updated").writeValue(pipelineSummary.getUpdated());
      }

      jsonGenerator.writeEndObject();
    } catch (Throwable t) {
      throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }
  }
  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;
  }
示例#3
0
  @Override
  public boolean equals(Object obj) {
    if (this == obj) return true;
    if (obj == null) return false;

    if (obj instanceof PipelineSummary == false) return false;
    PipelineSummary other = (PipelineSummary) obj;
    if (other.getName() == null ^ this.getName() == null) return false;
    if (other.getName() != null && other.getName().equals(this.getName()) == false) return false;
    if (other.getVersion() == null ^ this.getVersion() == null) return false;
    if (other.getVersion() != null && other.getVersion().equals(this.getVersion()) == false)
      return false;
    if (other.getCreated() == null ^ this.getCreated() == null) return false;
    if (other.getCreated() != null && other.getCreated().equals(this.getCreated()) == false)
      return false;
    if (other.getUpdated() == null ^ this.getUpdated() == null) return false;
    if (other.getUpdated() != null && other.getUpdated().equals(this.getUpdated()) == false)
      return false;
    return true;
  }