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