PageRenderTime 24ms CodeModel.GetById 34ms RepoModel.GetById 1ms app.codeStats 0ms

/aws-java-sdk-ec2/src/main/java/com/amazonaws/services/ec2/model/transform/RouteStaxUnmarshaller.java

https://github.com/aws/aws-sdk-java
Java | 140 lines | 98 code | 27 blank | 15 comment | 26 complexity | d4446e572408f870dc603aa708d02204 MD5 | raw file
  1. /*
  2. * Copyright 2016-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
  5. * the License. A copy of the License is located at
  6. *
  7. * http://aws.amazon.com/apache2.0
  8. *
  9. * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
  10. * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
  11. * and limitations under the License.
  12. */
  13. package com.amazonaws.services.ec2.model.transform;
  14. import javax.xml.stream.events.XMLEvent;
  15. import javax.annotation.Generated;
  16. import com.amazonaws.services.ec2.model.*;
  17. import com.amazonaws.transform.Unmarshaller;
  18. import com.amazonaws.transform.StaxUnmarshallerContext;
  19. import com.amazonaws.transform.SimpleTypeStaxUnmarshallers.*;
  20. /**
  21. * Route StAX Unmarshaller
  22. */
  23. @Generated("com.amazonaws:aws-java-sdk-code-generator")
  24. public class RouteStaxUnmarshaller implements Unmarshaller<Route, StaxUnmarshallerContext> {
  25. public Route unmarshall(StaxUnmarshallerContext context) throws Exception {
  26. Route route = new Route();
  27. int originalDepth = context.getCurrentDepth();
  28. int targetDepth = originalDepth + 1;
  29. if (context.isStartOfDocument())
  30. targetDepth += 1;
  31. while (true) {
  32. XMLEvent xmlEvent = context.nextEvent();
  33. if (xmlEvent.isEndDocument())
  34. return route;
  35. if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) {
  36. if (context.testExpression("destinationCidrBlock", targetDepth)) {
  37. route.setDestinationCidrBlock(StringStaxUnmarshaller.getInstance().unmarshall(context));
  38. continue;
  39. }
  40. if (context.testExpression("destinationIpv6CidrBlock", targetDepth)) {
  41. route.setDestinationIpv6CidrBlock(StringStaxUnmarshaller.getInstance().unmarshall(context));
  42. continue;
  43. }
  44. if (context.testExpression("destinationPrefixListId", targetDepth)) {
  45. route.setDestinationPrefixListId(StringStaxUnmarshaller.getInstance().unmarshall(context));
  46. continue;
  47. }
  48. if (context.testExpression("egressOnlyInternetGatewayId", targetDepth)) {
  49. route.setEgressOnlyInternetGatewayId(StringStaxUnmarshaller.getInstance().unmarshall(context));
  50. continue;
  51. }
  52. if (context.testExpression("gatewayId", targetDepth)) {
  53. route.setGatewayId(StringStaxUnmarshaller.getInstance().unmarshall(context));
  54. continue;
  55. }
  56. if (context.testExpression("instanceId", targetDepth)) {
  57. route.setInstanceId(StringStaxUnmarshaller.getInstance().unmarshall(context));
  58. continue;
  59. }
  60. if (context.testExpression("instanceOwnerId", targetDepth)) {
  61. route.setInstanceOwnerId(StringStaxUnmarshaller.getInstance().unmarshall(context));
  62. continue;
  63. }
  64. if (context.testExpression("natGatewayId", targetDepth)) {
  65. route.setNatGatewayId(StringStaxUnmarshaller.getInstance().unmarshall(context));
  66. continue;
  67. }
  68. if (context.testExpression("transitGatewayId", targetDepth)) {
  69. route.setTransitGatewayId(StringStaxUnmarshaller.getInstance().unmarshall(context));
  70. continue;
  71. }
  72. if (context.testExpression("localGatewayId", targetDepth)) {
  73. route.setLocalGatewayId(StringStaxUnmarshaller.getInstance().unmarshall(context));
  74. continue;
  75. }
  76. if (context.testExpression("carrierGatewayId", targetDepth)) {
  77. route.setCarrierGatewayId(StringStaxUnmarshaller.getInstance().unmarshall(context));
  78. continue;
  79. }
  80. if (context.testExpression("networkInterfaceId", targetDepth)) {
  81. route.setNetworkInterfaceId(StringStaxUnmarshaller.getInstance().unmarshall(context));
  82. continue;
  83. }
  84. if (context.testExpression("origin", targetDepth)) {
  85. route.setOrigin(StringStaxUnmarshaller.getInstance().unmarshall(context));
  86. continue;
  87. }
  88. if (context.testExpression("state", targetDepth)) {
  89. route.setState(StringStaxUnmarshaller.getInstance().unmarshall(context));
  90. continue;
  91. }
  92. if (context.testExpression("vpcPeeringConnectionId", targetDepth)) {
  93. route.setVpcPeeringConnectionId(StringStaxUnmarshaller.getInstance().unmarshall(context));
  94. continue;
  95. }
  96. if (context.testExpression("coreNetworkArn", targetDepth)) {
  97. route.setCoreNetworkArn(StringStaxUnmarshaller.getInstance().unmarshall(context));
  98. continue;
  99. }
  100. } else if (xmlEvent.isEndElement()) {
  101. if (context.getCurrentDepth() < originalDepth) {
  102. return route;
  103. }
  104. }
  105. }
  106. }
  107. private static RouteStaxUnmarshaller instance;
  108. public static RouteStaxUnmarshaller getInstance() {
  109. if (instance == null)
  110. instance = new RouteStaxUnmarshaller();
  111. return instance;
  112. }
  113. }