/** * <p> * <i>Required</i>. A string used to identify this tag. You can specify a maximum of 128 characters for a tag key. * Tags owned by Amazon Web Services (AWS) have the reserved prefix: <code>aws:</code>. * </p> * * @param key * <i>Required</i>. A string used to identify this tag. You can specify a maximum of 128 characters for a tag * key. Tags owned by Amazon Web Services (AWS) have the reserved prefix: <code>aws:</code>. * @return Returns a reference to this object so that method calls can be chained together. */ public Tag withKey(String key) { setKey(key); return this; }
public Tag unmarshall(StaxUnmarshallerContext context) throws Exception { Tag tag = new Tag(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; if (context.isStartOfDocument()) targetDepth += 1; while (true) { XMLEvent xmlEvent = context.nextEvent(); if (xmlEvent.isEndDocument()) return tag; if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) { if (context.testExpression("Key", targetDepth)) { tag.setKey(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("Value", targetDepth)) { tag.setValue(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } } else if (xmlEvent.isEndElement()) { if (context.getCurrentDepth() < originalDepth) { return tag; } } } }
/** * <p> * <i>Required</i>. A string used to identify this tag. You can specify a maximum of 128 characters for a tag key. * Tags owned by Amazon Web Services (AWS) have the reserved prefix: <code>aws:</code>. * </p> * * @param key * <i>Required</i>. A string used to identify this tag. You can specify a maximum of 128 characters for a tag * key. Tags owned by Amazon Web Services (AWS) have the reserved prefix: <code>aws:</code>. * @return Returns a reference to this object so that method calls can be chained together. */ public Tag withKey(String key) { setKey(key); return this; }
public Tag unmarshall(StaxUnmarshallerContext context) throws Exception { Tag tag = new Tag(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; if (context.isStartOfDocument()) targetDepth += 1; while (true) { XMLEvent xmlEvent = context.nextEvent(); if (xmlEvent.isEndDocument()) return tag; if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) { if (context.testExpression("Key", targetDepth)) { tag.setKey(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("Value", targetDepth)) { tag.setValue(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } } else if (xmlEvent.isEndElement()) { if (context.getCurrentDepth() < originalDepth) { return tag; } } } }