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

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

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

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

        if (context.testExpression("TrafficPolicies/TrafficPolicy", targetDepth)) {
          listTrafficPolicyVersionsResult
              .getTrafficPolicies()
              .add(TrafficPolicyStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }

        if (context.testExpression("IsTruncated", targetDepth)) {
          listTrafficPolicyVersionsResult.setIsTruncated(
              BooleanStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }

        if (context.testExpression("TrafficPolicyVersionMarker", targetDepth)) {
          listTrafficPolicyVersionsResult.setTrafficPolicyVersionMarker(
              StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }

        if (context.testExpression("MaxItems", targetDepth)) {
          listTrafficPolicyVersionsResult.setMaxItems(
              StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
      } else if (xmlEvent.isEndElement()) {
        if (context.getCurrentDepth() < originalDepth) {
          return listTrafficPolicyVersionsResult;
        }
      }
    }
  }
コード例 #2
0
  public HealthCheckConfig unmarshall(StaxUnmarshallerContext context) throws Exception {
    HealthCheckConfig healthCheckConfig = new HealthCheckConfig();
    int originalDepth = context.getCurrentDepth();
    int targetDepth = originalDepth + 1;
    if (context.isStartOfDocument()) targetDepth += 1;

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

      if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) {
        if (context.testExpression("IPAddress", targetDepth)) {
          healthCheckConfig.setIPAddress(StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
        if (context.testExpression("Port", targetDepth)) {
          healthCheckConfig.setPort(IntegerStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
        if (context.testExpression("Type", targetDepth)) {
          healthCheckConfig.setType(StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
        if (context.testExpression("ResourcePath", targetDepth)) {
          healthCheckConfig.setResourcePath(
              StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
        if (context.testExpression("FullyQualifiedDomainName", targetDepth)) {
          healthCheckConfig.setFullyQualifiedDomainName(
              StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
        if (context.testExpression("SearchString", targetDepth)) {
          healthCheckConfig.setSearchString(
              StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
        if (context.testExpression("RequestInterval", targetDepth)) {
          healthCheckConfig.setRequestInterval(
              IntegerStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
        if (context.testExpression("FailureThreshold", targetDepth)) {
          healthCheckConfig.setFailureThreshold(
              IntegerStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
        if (context.testExpression("MeasureLatency", targetDepth)) {
          healthCheckConfig.setMeasureLatency(
              BooleanStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
        if (context.testExpression("Inverted", targetDepth)) {
          healthCheckConfig.setInverted(BooleanStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
        if (context.testExpression("HealthThreshold", targetDepth)) {
          healthCheckConfig.setHealthThreshold(
              IntegerStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
        if (context.testExpression("ChildHealthChecks/ChildHealthCheck", targetDepth)) {
          healthCheckConfig
              .getChildHealthChecks()
              .add(StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
      } else if (xmlEvent.isEndElement()) {
        if (context.getCurrentDepth() < originalDepth) {
          return healthCheckConfig;
        }
      }
    }
  }