Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
7473 vikram.rag 1
 
2
package com.amazonservices.mws.orders.model;
3
 
4
import javax.xml.bind.annotation.XmlAccessType;
5
import javax.xml.bind.annotation.XmlAccessorType;
6
import javax.xml.bind.annotation.XmlElement;
7
import javax.xml.bind.annotation.XmlRootElement;
8
import javax.xml.bind.annotation.XmlType;
9
 
10
 
11
/**
12
 * <p>Java class for anonymous complex type.
13
 * 
14
 * <p>The following schema fragment specifies the expected content contained within this class.
15
 * 
16
 * <pre>
17
 * &lt;complexType>
18
 *   &lt;complexContent>
19
 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
20
 *       &lt;sequence>
21
 *         &lt;element name="NextToken" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
22
 *         &lt;element name="AmazonOrderId" type="{http://www.w3.org/2001/XMLSchema}string"/>
23
 *         &lt;element name="OrderItems" type="{https://mws.amazonservices.com/Orders/2011-01-01}OrderItemList" minOccurs="0"/>
24
 *       &lt;/sequence>
25
 *     &lt;/restriction>
26
 *   &lt;/complexContent>
27
 * &lt;/complexType>
28
 * </pre>
29
 * 
30
 * 
31
 */
32
@XmlAccessorType(XmlAccessType.FIELD)
33
@XmlType(name = "", propOrder = {
34
    "nextToken",
35
    "amazonOrderId",
36
    "orderItems"
37
})
38
@XmlRootElement(name = "ListOrderItemsResult")
39
public class ListOrderItemsResult {
40
 
41
    @XmlElement(name = "NextToken")
42
    protected String nextToken;
43
    @XmlElement(name = "AmazonOrderId", required = true)
44
    protected String amazonOrderId;
45
    @XmlElement(name = "OrderItems")
46
    protected OrderItemList orderItems;
47
 
48
    /**
49
     * Default constructor
50
     * 
51
     */
52
    public ListOrderItemsResult() {
53
        super();
54
    }
55
 
56
    /**
57
     * Value constructor
58
     * 
59
     */
60
    public ListOrderItemsResult(final String nextToken, final String amazonOrderId, final OrderItemList orderItems) {
61
        this.nextToken = nextToken;
62
        this.amazonOrderId = amazonOrderId;
63
        this.orderItems = orderItems;
64
    }
65
 
66
    /**
67
     * Gets the value of the nextToken property.
68
     * 
69
     * @return
70
     *     possible object is
71
     *     {@link String }
72
     *     
73
     */
74
    public String getNextToken() {
75
        return nextToken;
76
    }
77
 
78
    /**
79
     * Sets the value of the nextToken property.
80
     * 
81
     * @param value
82
     *     allowed object is
83
     *     {@link String }
84
     *     
85
     */
86
    public void setNextToken(String value) {
87
        this.nextToken = value;
88
    }
89
 
90
    public boolean isSetNextToken() {
91
        return (this.nextToken!= null);
92
    }
93
 
94
    /**
95
     * Gets the value of the amazonOrderId property.
96
     * 
97
     * @return
98
     *     possible object is
99
     *     {@link String }
100
     *     
101
     */
102
    public String getAmazonOrderId() {
103
        return amazonOrderId;
104
    }
105
 
106
    /**
107
     * Sets the value of the amazonOrderId property.
108
     * 
109
     * @param value
110
     *     allowed object is
111
     *     {@link String }
112
     *     
113
     */
114
    public void setAmazonOrderId(String value) {
115
        this.amazonOrderId = value;
116
    }
117
 
118
    public boolean isSetAmazonOrderId() {
119
        return (this.amazonOrderId!= null);
120
    }
121
 
122
    /**
123
     * Gets the value of the orderItems property.
124
     * 
125
     * @return
126
     *     possible object is
127
     *     {@link OrderItemList }
128
     *     
129
     */
130
    public OrderItemList getOrderItems() {
131
        return orderItems;
132
    }
133
 
134
    /**
135
     * Sets the value of the orderItems property.
136
     * 
137
     * @param value
138
     *     allowed object is
139
     *     {@link OrderItemList }
140
     *     
141
     */
142
    public void setOrderItems(OrderItemList value) {
143
        this.orderItems = value;
144
    }
145
 
146
    public boolean isSetOrderItems() {
147
        return (this.orderItems!= null);
148
    }
149
 
150
    /**
151
     * Sets the value of the NextToken property.
152
     * 
153
     * @param value
154
     * @return
155
     *     this instance
156
     */
157
    public ListOrderItemsResult withNextToken(String value) {
158
        setNextToken(value);
159
        return this;
160
    }
161
 
162
    /**
163
     * Sets the value of the AmazonOrderId property.
164
     * 
165
     * @param value
166
     * @return
167
     *     this instance
168
     */
169
    public ListOrderItemsResult withAmazonOrderId(String value) {
170
        setAmazonOrderId(value);
171
        return this;
172
    }
173
 
174
    /**
175
     * Sets the value of the OrderItems property.
176
     * 
177
     * @param value
178
     * @return
179
     *     this instance
180
     */
181
    public ListOrderItemsResult withOrderItems(OrderItemList value) {
182
        setOrderItems(value);
183
        return this;
184
    }
185
 
186
 
187
 
188
    /**
189
     * 
190
     * XML fragment representation of this object
191
     * 
192
     * @return XML fragment for this object. Name for outer
193
     * tag expected to be set by calling method. This fragment
194
     * returns inner properties representation only
195
     */
196
    public String toXMLFragment() {
197
        StringBuffer xml = new StringBuffer();
198
        if (isSetNextToken()) {
199
            xml.append("<NextToken>");
200
            xml.append(escapeXML(getNextToken()));
201
            xml.append("</NextToken>");
202
        }
203
        if (isSetAmazonOrderId()) {
204
            xml.append("<AmazonOrderId>");
205
            xml.append(escapeXML(getAmazonOrderId()));
206
            xml.append("</AmazonOrderId>");
207
        }
208
        if (isSetOrderItems()) {
209
            OrderItemList  orderItems = getOrderItems();
210
            xml.append("<OrderItems>");
211
            xml.append(orderItems.toXMLFragment());
212
            xml.append("</OrderItems>");
213
        } 
214
        return xml.toString();
215
    }
216
 
217
    /**
218
     * 
219
     * Escape XML special characters
220
     */
221
    private String escapeXML(String string) {
222
        if (string == null)
223
            return "null";
224
        StringBuffer sb = new StringBuffer();
225
        int length = string.length();
226
        for (int i = 0; i < length; ++i) {
227
            char c = string.charAt(i);
228
            switch (c) {
229
            case '&':
230
                sb.append("&amp;");
231
                break;
232
            case '<':
233
                sb.append("&lt;");
234
                break;
235
            case '>':
236
                sb.append("&gt;");
237
                break;
238
            case '\'':
239
                sb.append("&#039;");
240
                break;
241
            case '"':
242
                sb.append("&quot;");
243
                break;
244
            default:
245
                sb.append(c);
246
            }
247
        }
248
        return sb.toString();
249
    }
250
 
251
 
252
 
253
    /**
254
     *
255
     * JSON fragment representation of this object
256
     *
257
     * @return JSON fragment for this object. Name for outer
258
     * object expected to be set by calling method. This fragment
259
     * returns inner properties representation only
260
     *
261
     */
262
    protected String toJSONFragment() {
263
        StringBuffer json = new StringBuffer();
264
        boolean first = true;
265
        if (isSetNextToken()) {
266
            if (!first) json.append(", ");
267
            json.append(quoteJSON("NextToken"));
268
            json.append(" : ");
269
            json.append(quoteJSON(getNextToken()));
270
            first = false;
271
        }
272
        if (isSetAmazonOrderId()) {
273
            if (!first) json.append(", ");
274
            json.append(quoteJSON("AmazonOrderId"));
275
            json.append(" : ");
276
            json.append(quoteJSON(getAmazonOrderId()));
277
            first = false;
278
        }
279
        if (isSetOrderItems()) {
280
            if (!first) json.append(", ");
281
            json.append("\"OrderItems\" : {");
282
            OrderItemList  orderItems = getOrderItems();
283
 
284
 
285
            json.append(orderItems.toJSONFragment());
286
            json.append("}");
287
            first = false;
288
        }
289
        return json.toString();
290
    }
291
 
292
    /**
293
     *
294
     * Quote JSON string
295
     */
296
    private String quoteJSON(String string) {
297
        if (string == null)
298
            return "null";
299
        StringBuffer sb = new StringBuffer();
300
        sb.append("\"");
301
        int length = string.length();
302
        for (int i = 0; i < length; ++i) {
303
            char c = string.charAt(i);
304
            switch (c) {
305
            case '"':
306
                sb.append("\\\"");
307
                break;
308
            case '\\':
309
                sb.append("\\\\");
310
                break;
311
            case '/':
312
                sb.append("\\/");
313
                break;
314
            case '\b':
315
                sb.append("\\b");
316
                break;
317
            case '\f':
318
                sb.append("\\f");
319
                break;
320
            case '\n':
321
                sb.append("\\n");
322
                break;
323
            case '\r':
324
                sb.append("\\r");
325
                break;
326
            case '\t':
327
                sb.append("\\t");
328
                break;
329
            default:
330
                if (c <  ' ') {
331
                    sb.append("\\u" + String.format("%03x", Integer.valueOf(c)));
332
                } else {
333
                sb.append(c);
334
            }
335
        }
336
        }
337
        sb.append("\"");
338
        return sb.toString();
339
    }
340
 
341
 
342
}