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

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

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

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

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

        if (context.testExpression("name", targetDepth)) {
          iamInstanceProfileSpecification.setName(
              StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
      } else if (xmlEvent.isEndElement()) {
        if (context.getCurrentDepth() < originalDepth) {
          return iamInstanceProfileSpecification;
        }
      }
    }
  }
  @Override
  public boolean equals(Object obj) {
    if (this == obj) return true;
    if (obj == null) return false;

    if (obj instanceof IamInstanceProfileSpecification == false) return false;
    IamInstanceProfileSpecification other = (IamInstanceProfileSpecification) obj;
    if (other.getArn() == null ^ this.getArn() == null) return false;
    if (other.getArn() != null && other.getArn().equals(this.getArn()) == false) return false;
    if (other.getName() == null ^ this.getName() == null) return false;
    if (other.getName() != null && other.getName().equals(this.getName()) == false) return false;
    return true;
  }