1 /*
2  * Copyright 2015-2020 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.sqs.model.transform;
14
15 import javax.xml.stream.events.XMLEvent;
16 import javax.annotation.Generated;
17
18 import com.amazonaws.services.sqs.model.*;
19 import com.amazonaws.transform.Unmarshaller;
20
21 import com.amazonaws.transform.StaxUnmarshallerContext;
22 import com.amazonaws.transform.SimpleTypeStaxUnmarshallers.*;
23
24 /**
25  * SendMessageResult StAX Unmarshaller
26  */

27
28 @Generated("com.amazonaws:aws-java-sdk-code-generator")
29 public class SendMessageResultStaxUnmarshaller implements Unmarshaller<SendMessageResult, StaxUnmarshallerContext> {
30
31     public SendMessageResult unmarshall(StaxUnmarshallerContext context) throws Exception {
32         SendMessageResult sendMessageResult = new SendMessageResult();
33         int originalDepth = context.getCurrentDepth();
34         int targetDepth = originalDepth + 1;
35
36         if (context.isStartOfDocument())
37             targetDepth += 2;
38
39         while (true) {
40             XMLEvent xmlEvent = context.nextEvent();
41             if (xmlEvent.isEndDocument())
42                 return sendMessageResult;
43
44             if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) {
45
46                 if (context.testExpression("MD5OfMessageBody", targetDepth)) {
47                     sendMessageResult.setMD5OfMessageBody(StringStaxUnmarshaller.getInstance().unmarshall(context));
48                     continue;
49                 }
50
51                 if (context.testExpression("MD5OfMessageAttributes", targetDepth)) {
52                     sendMessageResult.setMD5OfMessageAttributes(StringStaxUnmarshaller.getInstance().unmarshall(context));
53                     continue;
54                 }
55
56                 if (context.testExpression("MD5OfMessageSystemAttributes", targetDepth)) {
57                     sendMessageResult.setMD5OfMessageSystemAttributes(StringStaxUnmarshaller.getInstance().unmarshall(context));
58                     continue;
59                 }
60
61                 if (context.testExpression("MessageId", targetDepth)) {
62                     sendMessageResult.setMessageId(StringStaxUnmarshaller.getInstance().unmarshall(context));
63                     continue;
64                 }
65
66                 if (context.testExpression("SequenceNumber", targetDepth)) {
67                     sendMessageResult.setSequenceNumber(StringStaxUnmarshaller.getInstance().unmarshall(context));
68                     continue;
69                 }
70             } else if (xmlEvent.isEndElement()) {
71                 if (context.getCurrentDepth() < originalDepth) {
72                     return sendMessageResult;
73                 }
74             }
75         }
76     }
77
78     private static SendMessageResultStaxUnmarshaller instance;
79
80     public static SendMessageResultStaxUnmarshaller getInstance() {
81         if (instance == null)
82             instance = new SendMessageResultStaxUnmarshaller();
83         return instance;
84     }
85 }
86