public Deployment unmarshall(StaxUnmarshallerContext context) throws Exception {
    Deployment deployment = new Deployment();
    int originalDepth = context.getCurrentDepth();
    int targetDepth = originalDepth + 1;

    if (context.isStartOfDocument()) targetDepth += 1;

    while (true) {
      XMLEvent xmlEvent = context.nextEvent();
      if (xmlEvent.isEndDocument()) return deployment;

      if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) {

        if (context.testExpression("VersionLabel", targetDepth)) {
          deployment.setVersionLabel(StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }

        if (context.testExpression("DeploymentId", targetDepth)) {
          deployment.setDeploymentId(LongStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }

        if (context.testExpression("Status", targetDepth)) {
          deployment.setStatus(StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }

        if (context.testExpression("DeploymentTime", targetDepth)) {
          deployment.setDeploymentTime(DateStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
      } else if (xmlEvent.isEndElement()) {
        if (context.getCurrentDepth() < originalDepth) {
          return deployment;
        }
      }
    }
  }
예제 #2
0
 /**
  * The ID of the deployment. This number increases by one each time that you deploy source code or
  * change instance configuration settings.
  *
  * @param deploymentId The ID of the deployment. This number increases by one each time that you
  *     deploy source code or change instance configuration settings.
  * @return Returns a reference to this object so that method calls can be chained together.
  */
 public Deployment withDeploymentId(Long deploymentId) {
   setDeploymentId(deploymentId);
   return this;
 }