public HealthCheck unmarshall(StaxUnmarshallerContext context) throws Exception { HealthCheck healthCheck = new HealthCheck(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; if (context.isStartOfDocument()) targetDepth += 1; while (true) { XMLEvent xmlEvent = context.nextEvent(); if (xmlEvent.isEndDocument()) return healthCheck; if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) { if (context.testExpression("Id", targetDepth)) { healthCheck.setId(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("CallerReference", targetDepth)) { healthCheck.setCallerReference(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("HealthCheckConfig", targetDepth)) { healthCheck.setHealthCheckConfig( HealthCheckConfigStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("HealthCheckVersion", targetDepth)) { healthCheck.setHealthCheckVersion(LongStaxUnmarshaller.getInstance().unmarshall(context)); continue; } } else if (xmlEvent.isEndElement()) { if (context.getCurrentDepth() < originalDepth) { return healthCheck; } } } }