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
  @Override
  public boolean equals(Object obj) {
    if (this == obj) return true;
    if (obj == null) return false;

    if (obj instanceof Deployment == false) return false;
    Deployment other = (Deployment) obj;
    if (other.getVersionLabel() == null ^ this.getVersionLabel() == null) return false;
    if (other.getVersionLabel() != null
        && other.getVersionLabel().equals(this.getVersionLabel()) == false) return false;
    if (other.getDeploymentId() == null ^ this.getDeploymentId() == null) return false;
    if (other.getDeploymentId() != null
        && other.getDeploymentId().equals(this.getDeploymentId()) == false) return false;
    if (other.getStatus() == null ^ this.getStatus() == null) return false;
    if (other.getStatus() != null && other.getStatus().equals(this.getStatus()) == false)
      return false;
    if (other.getDeploymentTime() == null ^ this.getDeploymentTime() == null) return false;
    if (other.getDeploymentTime() != null
        && other.getDeploymentTime().equals(this.getDeploymentTime()) == false) return false;
    return true;
  }