@Override
  public boolean equals(Object obj) {
    if (this == obj) return true;
    if (obj == null) return false;

    if (obj instanceof NetworkInterface == false) return false;
    NetworkInterface other = (NetworkInterface) obj;

    if (other.getNetworkInterfaceId() == null ^ this.getNetworkInterfaceId() == null) return false;
    if (other.getNetworkInterfaceId() != null
        && other.getNetworkInterfaceId().equals(this.getNetworkInterfaceId()) == false)
      return false;
    if (other.getSubnetId() == null ^ this.getSubnetId() == null) return false;
    if (other.getSubnetId() != null && other.getSubnetId().equals(this.getSubnetId()) == false)
      return false;
    if (other.getVpcId() == null ^ this.getVpcId() == null) return false;
    if (other.getVpcId() != null && other.getVpcId().equals(this.getVpcId()) == false) return false;
    if (other.getAvailabilityZone() == null ^ this.getAvailabilityZone() == null) return false;
    if (other.getAvailabilityZone() != null
        && other.getAvailabilityZone().equals(this.getAvailabilityZone()) == false) return false;
    if (other.getDescription() == null ^ this.getDescription() == null) return false;
    if (other.getDescription() != null
        && other.getDescription().equals(this.getDescription()) == false) return false;
    if (other.getOwnerId() == null ^ this.getOwnerId() == null) return false;
    if (other.getOwnerId() != null && other.getOwnerId().equals(this.getOwnerId()) == false)
      return false;
    if (other.getRequesterId() == null ^ this.getRequesterId() == null) return false;
    if (other.getRequesterId() != null
        && other.getRequesterId().equals(this.getRequesterId()) == false) return false;
    if (other.isRequesterManaged() == null ^ this.isRequesterManaged() == null) return false;
    if (other.isRequesterManaged() != null
        && other.isRequesterManaged().equals(this.isRequesterManaged()) == false) return false;
    if (other.getStatus() == null ^ this.getStatus() == null) return false;
    if (other.getStatus() != null && other.getStatus().equals(this.getStatus()) == false)
      return false;
    if (other.getMacAddress() == null ^ this.getMacAddress() == null) return false;
    if (other.getMacAddress() != null
        && other.getMacAddress().equals(this.getMacAddress()) == false) return false;
    if (other.getPrivateIpAddress() == null ^ this.getPrivateIpAddress() == null) return false;
    if (other.getPrivateIpAddress() != null
        && other.getPrivateIpAddress().equals(this.getPrivateIpAddress()) == false) return false;
    if (other.getPrivateDnsName() == null ^ this.getPrivateDnsName() == null) return false;
    if (other.getPrivateDnsName() != null
        && other.getPrivateDnsName().equals(this.getPrivateDnsName()) == false) return false;
    if (other.isSourceDestCheck() == null ^ this.isSourceDestCheck() == null) return false;
    if (other.isSourceDestCheck() != null
        && other.isSourceDestCheck().equals(this.isSourceDestCheck()) == false) return false;
    if (other.getGroups() == null ^ this.getGroups() == null) return false;
    if (other.getGroups() != null && other.getGroups().equals(this.getGroups()) == false)
      return false;
    if (other.getAttachment() == null ^ this.getAttachment() == null) return false;
    if (other.getAttachment() != null
        && other.getAttachment().equals(this.getAttachment()) == false) return false;
    if (other.getAssociation() == null ^ this.getAssociation() == null) return false;
    if (other.getAssociation() != null
        && other.getAssociation().equals(this.getAssociation()) == false) return false;
    if (other.getTagSet() == null ^ this.getTagSet() == null) return false;
    if (other.getTagSet() != null && other.getTagSet().equals(this.getTagSet()) == false)
      return false;
    if (other.getPrivateIpAddresses() == null ^ this.getPrivateIpAddresses() == null) return false;
    if (other.getPrivateIpAddresses() != null
        && other.getPrivateIpAddresses().equals(this.getPrivateIpAddresses()) == false)
      return false;
    if (other.getInterfaceType() == null ^ this.getInterfaceType() == null) return false;
    if (other.getInterfaceType() != null
        && other.getInterfaceType().equals(this.getInterfaceType()) == false) return false;
    return true;
  }
  public NetworkInterface unmarshall(StaxUnmarshallerContext context) throws Exception {
    NetworkInterface networkInterface = new NetworkInterface();
    int originalDepth = context.getCurrentDepth();
    int targetDepth = originalDepth + 1;

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

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

      if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) {
        if (context.testExpression("networkInterfaceId", targetDepth)) {
          networkInterface.setNetworkInterfaceId(
              StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
        if (context.testExpression("subnetId", targetDepth)) {
          networkInterface.setSubnetId(StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
        if (context.testExpression("vpcId", targetDepth)) {
          networkInterface.setVpcId(StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
        if (context.testExpression("availabilityZone", targetDepth)) {
          networkInterface.setAvailabilityZone(
              StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
        if (context.testExpression("description", targetDepth)) {
          networkInterface.setDescription(StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
        if (context.testExpression("ownerId", targetDepth)) {
          networkInterface.setOwnerId(StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
        if (context.testExpression("requesterId", targetDepth)) {
          networkInterface.setRequesterId(StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
        if (context.testExpression("requesterManaged", targetDepth)) {
          networkInterface.setRequesterManaged(
              BooleanStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
        if (context.testExpression("status", targetDepth)) {
          networkInterface.setStatus(StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
        if (context.testExpression("macAddress", targetDepth)) {
          networkInterface.setMacAddress(StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
        if (context.testExpression("privateIpAddress", targetDepth)) {
          networkInterface.setPrivateIpAddress(
              StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
        if (context.testExpression("privateDnsName", targetDepth)) {
          networkInterface.setPrivateDnsName(
              StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
        if (context.testExpression("sourceDestCheck", targetDepth)) {
          networkInterface.setSourceDestCheck(
              BooleanStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
        if (context.testExpression("groupSet/item", targetDepth)) {
          networkInterface
              .getGroups()
              .add(GroupIdentifierStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
        if (context.testExpression("attachment", targetDepth)) {
          networkInterface.setAttachment(
              NetworkInterfaceAttachmentStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
        if (context.testExpression("association", targetDepth)) {
          networkInterface.setAssociation(
              NetworkInterfaceAssociationStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
        if (context.testExpression("tagSet/item", targetDepth)) {
          networkInterface.getTagSet().add(TagStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
        if (context.testExpression("privateIpAddressesSet/item", targetDepth)) {
          networkInterface
              .getPrivateIpAddresses()
              .add(
                  NetworkInterfacePrivateIpAddressStaxUnmarshaller.getInstance()
                      .unmarshall(context));
          continue;
        }
      } else if (xmlEvent.isEndElement()) {
        if (context.getCurrentDepth() < originalDepth) {
          return networkInterface;
        }
      }
    }
  }