コード例 #1
0
  public HealthCheck unmarshall(StaxUnmarshallerContext context) throws Exception {
    HealthCheck healthCheck = new HealthCheck();
    int originalDepth = context.getCurrentDepth();
    int targetDepth = originalDepth + 1;

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

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

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

        if (context.testExpression("Id", targetDepth)) {
          healthCheck.setId(StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }

        if (context.testExpression("CallerReference", targetDepth)) {
          healthCheck.setCallerReference(StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }

        if (context.testExpression("HealthCheckConfig", targetDepth)) {
          healthCheck.setHealthCheckConfig(
              HealthCheckConfigStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }

        if (context.testExpression("HealthCheckVersion", targetDepth)) {
          healthCheck.setHealthCheckVersion(LongStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
      } else if (xmlEvent.isEndElement()) {
        if (context.getCurrentDepth() < originalDepth) {
          return healthCheck;
        }
      }
    }
  }
コード例 #2
0
  public ResourceRecordSet unmarshall(StaxUnmarshallerContext context) throws Exception {
    ResourceRecordSet resourceRecordSet = new ResourceRecordSet();
    int originalDepth = context.getCurrentDepth();
    int targetDepth = originalDepth + 1;
    if (context.isStartOfDocument()) targetDepth += 1;

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

      if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) {
        if (context.testExpression("Name", targetDepth)) {
          resourceRecordSet.setName(StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
        if (context.testExpression("Type", targetDepth)) {
          resourceRecordSet.setType(StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
        if (context.testExpression("SetIdentifier", targetDepth)) {
          resourceRecordSet.setSetIdentifier(
              StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
        if (context.testExpression("Weight", targetDepth)) {
          resourceRecordSet.setWeight(LongStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
        if (context.testExpression("Region", targetDepth)) {
          resourceRecordSet.setRegion(StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
        if (context.testExpression("GeoLocation", targetDepth)) {
          resourceRecordSet.setGeoLocation(
              GeoLocationStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
        if (context.testExpression("Failover", targetDepth)) {
          resourceRecordSet.setFailover(StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
        if (context.testExpression("TTL", targetDepth)) {
          resourceRecordSet.setTTL(LongStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
        if (context.testExpression("ResourceRecords/ResourceRecord", targetDepth)) {
          resourceRecordSet
              .getResourceRecords()
              .add(ResourceRecordStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
        if (context.testExpression("AliasTarget", targetDepth)) {
          resourceRecordSet.setAliasTarget(
              AliasTargetStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
        if (context.testExpression("HealthCheckId", targetDepth)) {
          resourceRecordSet.setHealthCheckId(
              StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
      } else if (xmlEvent.isEndElement()) {
        if (context.getCurrentDepth() < originalDepth) {
          return resourceRecordSet;
        }
      }
    }
  }