示例#1
0
 /** {@inheritDoc} */
 @Override
 public Instance getResult() {
   try {
     return builder.build();
   } finally {
     builder = Instance.builder();
   }
 }
示例#2
0
  /** {@inheritDoc} */
  @Override
  public void endElement(String uri, String name, String qName) throws SAXException {

    if (equalsOrSuffix(qName, "SubnetGroup")) {
      builder.subnetGroup(subnetGroupHandler.getResult());
      inSubnetGroup = false;
    } else if (equalsOrSuffix(qName, "DBInstanceIdentifier")) {
      builder.id(currentOrNull(currentText));
    } else if (equalsOrSuffix(qName, "InstanceCreateTime")) {
      builder.createdTime(dateService.iso8601DateParse(currentOrNull(currentText)));
    } else if (equalsOrSuffix(qName, "DBName")) {
      builder.name(currentOrNull(currentText));
    } else if (equalsOrSuffix(qName, "AllocatedStorage")) {
      builder.allocatedStorageGB(Integer.parseInt(currentOrNull(currentText)));
    } else if (equalsOrSuffix(qName, "DBInstanceStatus")) {
      builder.status(currentOrNull(currentText));
    } else if (equalsOrSuffix(qName, "Address")) {
      address = currentOrNull(currentText);
    } else if (equalsOrSuffix(qName, "Port")) {
      port = new Integer(currentOrNull(currentText));
    } else if (equalsOrSuffix(qName, "Endpoint")) {
      builder.endpoint(HostAndPort.fromParts(address, port));
      address = null;
      port = null;
    } else if (equalsOrSuffix(qName, "DBSecurityGroupName")) {
      groupName = currentOrNull(currentText);
    } else if (equalsOrSuffix(qName, "Status")) {
      status = currentOrNull(currentText);
    } else if (equalsOrSuffix(qName, "DBSecurityGroup")) {
      securityGroupBuilder.put(groupName, status);
      groupName = status = null;
    } else if (equalsOrSuffix(qName, "DBSecurityGroups")) {
      builder.securityGroupNameToStatus(securityGroupBuilder.build());
      securityGroupBuilder = ImmutableMap.<String, String>builder();
    } else if (equalsOrSuffix(qName, "DBInstanceClass")) {
      builder.instanceClass(currentOrNull(currentText));
    } else if (equalsOrSuffix(qName, "AvailabilityZone")) {
      builder.availabilityZone(currentOrNull(currentText));
    } else if (equalsOrSuffix(qName, "MultiAZ")) {
      builder.multiAZ(Boolean.parseBoolean(currentOrNull(currentText)));
    } else if (equalsOrSuffix(qName, "Engine")) {
      builder.engine(currentOrNull(currentText));
    } else if (equalsOrSuffix(qName, "EngineVersion")) {
      builder.engineVersion(currentOrNull(currentText));
    } else if (equalsOrSuffix(qName, "LicenseModel")) {
      builder.licenseModel(currentOrNull(currentText));
    } else if (equalsOrSuffix(qName, "MasterUsername")) {
      builder.masterUsername(currentOrNull(currentText));
    } else if (inSubnetGroup) {
      subnetGroupHandler.endElement(uri, name, qName);
    }
    currentText = new StringBuilder();
  }