/** * <p> * The launch template to use. You must specify either the launch template ID or launch template name in the * request. * </p> * * @param launchTemplateSpecification * The launch template to use. You must specify either the launch template ID or launch template name in the * request. * @return Returns a reference to this object so that method calls can be chained together. */ public LaunchTemplate withLaunchTemplateSpecification(LaunchTemplateSpecification launchTemplateSpecification) { setLaunchTemplateSpecification(launchTemplateSpecification); return this; }
public LaunchTemplate unmarshall(StaxUnmarshallerContext context) throws Exception { LaunchTemplate launchTemplate = new LaunchTemplate(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; if (context.isStartOfDocument()) targetDepth += 1; while (true) { XMLEvent xmlEvent = context.nextEvent(); if (xmlEvent.isEndDocument()) return launchTemplate; if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) { if (context.testExpression("LaunchTemplateSpecification", targetDepth)) { launchTemplate.setLaunchTemplateSpecification(LaunchTemplateSpecificationStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("Overrides", targetDepth)) { launchTemplate.withOverrides(new ArrayList<LaunchTemplateOverrides>()); continue; } if (context.testExpression("Overrides/member", targetDepth)) { launchTemplate.withOverrides(LaunchTemplateOverridesStaxUnmarshaller.getInstance().unmarshall(context)); continue; } } else if (xmlEvent.isEndElement()) { if (context.getCurrentDepth() < originalDepth) { return launchTemplate; } } } }
public LaunchTemplate unmarshall(StaxUnmarshallerContext context) throws Exception { LaunchTemplate launchTemplate = new LaunchTemplate(); 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("LaunchTemplateSpecification", targetDepth)) { launchTemplate .setLaunchTemplateSpecification(LaunchTemplateSpecificationStaxUnmarshaller .getInstance().unmarshall(context)); continue; } if (context.testExpression("Overrides/member", targetDepth)) { launchTemplate.withOverrides(LaunchTemplateOverridesStaxUnmarshaller .getInstance().unmarshall(context)); continue; } } else if (xmlEvent == XmlPullParser.END_TAG) { if (context.getCurrentDepth() < originalDepth) { break; } } } return launchTemplate; }