/** * <p> * A label for the specified metric. * </p> * * @param label * A label for the specified metric. * @return Returns a reference to this object so that method calls can be chained together. */ public GetMetricStatisticsResult withLabel(String label) { setLabel(label); return this; }
public GetMetricStatisticsResult unmarshall(StaxUnmarshallerContext context) throws Exception { GetMetricStatisticsResult getMetricStatisticsResult = new GetMetricStatisticsResult(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; if (context.isStartOfDocument()) targetDepth += 2; while (true) { XMLEvent xmlEvent = context.nextEvent(); if (xmlEvent.isEndDocument()) return getMetricStatisticsResult; if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) { if (context.testExpression("Label", targetDepth)) { getMetricStatisticsResult.setLabel(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("Datapoints", targetDepth)) { getMetricStatisticsResult.withDatapoints(new ArrayList<Datapoint>()); continue; } if (context.testExpression("Datapoints/member", targetDepth)) { getMetricStatisticsResult.withDatapoints(DatapointStaxUnmarshaller.getInstance().unmarshall(context)); continue; } } else if (xmlEvent.isEndElement()) { if (context.getCurrentDepth() < originalDepth) { return getMetricStatisticsResult; } } } }
public GetMetricStatisticsResult unmarshall(StaxUnmarshallerContext context) throws Exception { GetMetricStatisticsResult getMetricStatisticsResult = new GetMetricStatisticsResult(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; if (context.isStartOfDocument()) targetDepth += 2; while (true) { int xmlEvent = context.nextEvent(); if (xmlEvent == XmlPullParser.END_DOCUMENT) break; if (xmlEvent == XmlPullParser.START_TAG) { if (context.testExpression("Label", targetDepth)) { getMetricStatisticsResult.setLabel(StringStaxUnmarshaller.getInstance() .unmarshall(context)); continue; } if (context.testExpression("Datapoints/member", targetDepth)) { getMetricStatisticsResult.withDatapoints(DatapointStaxUnmarshaller .getInstance().unmarshall(context)); continue; } } else if (xmlEvent == XmlPullParser.END_TAG) { if (context.getCurrentDepth() < originalDepth) { break; } } } return getMetricStatisticsResult; }