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

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

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

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

        if (context.testExpression("UserName", targetDepth)) {
          loginProfile.setUserName(StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }

        if (context.testExpression("CreateDate", targetDepth)) {
          loginProfile.setCreateDate(DateStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }

        if (context.testExpression("PasswordResetRequired", targetDepth)) {
          loginProfile.setPasswordResetRequired(
              BooleanStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
      } else if (xmlEvent.isEndElement()) {
        if (context.getCurrentDepth() < originalDepth) {
          return loginProfile;
        }
      }
    }
  }
コード例 #2
0
  public Role unmarshall(StaxUnmarshallerContext context) throws Exception {
    Role role = new Role();
    int originalDepth = context.getCurrentDepth();
    int targetDepth = originalDepth + 1;

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

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

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

        if (context.testExpression("Path", targetDepth)) {
          role.setPath(StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }

        if (context.testExpression("RoleName", targetDepth)) {
          role.setRoleName(StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }

        if (context.testExpression("RoleId", targetDepth)) {
          role.setRoleId(StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }

        if (context.testExpression("Arn", targetDepth)) {
          role.setArn(StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }

        if (context.testExpression("CreateDate", targetDepth)) {
          role.setCreateDate(DateStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }

        if (context.testExpression("AssumeRolePolicyDocument", targetDepth)) {
          role.setAssumeRolePolicyDocument(
              StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
      } else if (xmlEvent.isEndElement()) {
        if (context.getCurrentDepth() < originalDepth) {
          return role;
        }
      }
    }
  }
  public SigningCertificate unmarshall(StaxUnmarshallerContext context) throws Exception {
    SigningCertificate signingCertificate = new SigningCertificate();
    int originalDepth = context.getCurrentDepth();
    int targetDepth = originalDepth + 1;

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

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

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

        if (context.testExpression("UserName", targetDepth)) {
          signingCertificate.setUserName(StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }

        if (context.testExpression("CertificateId", targetDepth)) {
          signingCertificate.setCertificateId(
              StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }

        if (context.testExpression("CertificateBody", targetDepth)) {
          signingCertificate.setCertificateBody(
              StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }

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

        if (context.testExpression("UploadDate", targetDepth)) {
          signingCertificate.setUploadDate(DateStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
      } else if (xmlEvent.isEndElement()) {
        if (context.getCurrentDepth() < originalDepth) {
          return signingCertificate;
        }
      }
    }
  }