/** * <p> * The name of the filter. The valid values are: <code>"auto-scaling-group"</code>, <code>"key"</code>, * <code>"value"</code>, and <code>"propagate-at-launch"</code>. * </p> * * @param name * The name of the filter. The valid values are: <code>"auto-scaling-group"</code>, <code>"key"</code>, * <code>"value"</code>, and <code>"propagate-at-launch"</code>. * @return Returns a reference to this object so that method calls can be chained together. */ public Filter withName(String name) { setName(name); return this; }
public Filter unmarshall(StaxUnmarshallerContext context) throws Exception { Filter filter = new Filter(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; if (context.isStartOfDocument()) targetDepth += 1; while (true) { XMLEvent xmlEvent = context.nextEvent(); if (xmlEvent.isEndDocument()) return filter; if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) { if (context.testExpression("Name", targetDepth)) { filter.setName(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("Values", targetDepth)) { filter.withValues(new ArrayList<String>()); continue; } if (context.testExpression("Values/member", targetDepth)) { filter.withValues(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } } else if (xmlEvent.isEndElement()) { if (context.getCurrentDepth() < originalDepth) { return filter; } } } }
public Filter unmarshall(StaxUnmarshallerContext context) throws Exception { Filter filter = new Filter(); 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("Name", targetDepth)) { filter.setName(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("Values/member", targetDepth)) { filter.withValues(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } } else if (xmlEvent == XmlPullParser.END_TAG) { if (context.getCurrentDepth() < originalDepth) { break; } } } return filter; }