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

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

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

      if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) {
        if (context.testExpression("InstancePort", targetDepth)) {
          backendServerDescription.setInstancePort(
              IntegerStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
        if (context.testExpression("PolicyNames/member", targetDepth)) {
          backendServerDescription
              .getPolicyNames()
              .add(StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
      } else if (xmlEvent.isEndElement()) {
        if (context.getCurrentDepth() < originalDepth) {
          return backendServerDescription;
        }
      }
    }
  }
コード例 #2
0
 /**
  * The port on which the back-end server is listening.
  *
  * @param instancePort The port on which the back-end server is listening.
  * @return Returns a reference to this object so that method calls can be chained together.
  */
 public BackendServerDescription withInstancePort(Integer instancePort) {
   setInstancePort(instancePort);
   return this;
 }