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="Orders" type="{https://mws.amazonservices.com/Orders/2011-01-01}OrderList"/>
22
 *       &lt;/sequence>
23
 *     &lt;/restriction>
24
 *   &lt;/complexContent>
25
 * &lt;/complexType>
26
 * </pre>
27
 * 
28
 * 
29
 */
30
@XmlAccessorType(XmlAccessType.FIELD)
31
@XmlType(name = "", propOrder = {
32
    "orders"
33
})
34
@XmlRootElement(name = "GetOrderResult")
35
public class GetOrderResult {
36
 
37
    @XmlElement(name = "Orders", required = true)
38
    protected OrderList orders;
39
 
40
    /**
41
     * Default constructor
42
     * 
43
     */
44
    public GetOrderResult() {
45
        super();
46
    }
47
 
48
    /**
49
     * Value constructor
50
     * 
51
     */
52
    public GetOrderResult(final OrderList orders) {
53
        this.orders = orders;
54
    }
55
 
56
    /**
57
     * Gets the value of the orders property.
58
     * 
59
     * @return
60
     *     possible object is
61
     *     {@link OrderList }
62
     *     
63
     */
64
    public OrderList getOrders() {
65
        return orders;
66
    }
67
 
68
    /**
69
     * Sets the value of the orders property.
70
     * 
71
     * @param value
72
     *     allowed object is
73
     *     {@link OrderList }
74
     *     
75
     */
76
    public void setOrders(OrderList value) {
77
        this.orders = value;
78
    }
79
 
80
    public boolean isSetOrders() {
81
        return (this.orders!= null);
82
    }
83
 
84
    /**
85
     * Sets the value of the Orders property.
86
     * 
87
     * @param value
88
     * @return
89
     *     this instance
90
     */
91
    public GetOrderResult withOrders(OrderList value) {
92
        setOrders(value);
93
        return this;
94
    }
95
 
96
 
97
 
98
    /**
99
     * 
100
     * XML fragment representation of this object
101
     * 
102
     * @return XML fragment for this object. Name for outer
103
     * tag expected to be set by calling method. This fragment
104
     * returns inner properties representation only
105
     */
106
    public String toXMLFragment() {
107
        StringBuffer xml = new StringBuffer();
108
        if (isSetOrders()) {
109
            OrderList  orders = getOrders();
110
            xml.append("<Orders>");
111
            xml.append(orders.toXMLFragment());
112
            xml.append("</Orders>");
113
        } 
114
        return xml.toString();
115
    }
116
 
117
    /**
118
     * 
119
     * Escape XML special characters
120
     */
121
    private String escapeXML(String string) {
122
        if (string == null)
123
            return "null";
124
        StringBuffer sb = new StringBuffer();
125
        int length = string.length();
126
        for (int i = 0; i < length; ++i) {
127
            char c = string.charAt(i);
128
            switch (c) {
129
            case '&':
130
                sb.append("&amp;");
131
                break;
132
            case '<':
133
                sb.append("&lt;");
134
                break;
135
            case '>':
136
                sb.append("&gt;");
137
                break;
138
            case '\'':
139
                sb.append("&#039;");
140
                break;
141
            case '"':
142
                sb.append("&quot;");
143
                break;
144
            default:
145
                sb.append(c);
146
            }
147
        }
148
        return sb.toString();
149
    }
150
 
151
 
152
 
153
    /**
154
     *
155
     * JSON fragment representation of this object
156
     *
157
     * @return JSON fragment for this object. Name for outer
158
     * object expected to be set by calling method. This fragment
159
     * returns inner properties representation only
160
     *
161
     */
162
    protected String toJSONFragment() {
163
        StringBuffer json = new StringBuffer();
164
        boolean first = true;
165
        if (isSetOrders()) {
166
            if (!first) json.append(", ");
167
            json.append("\"Orders\" : {");
168
            OrderList  orders = getOrders();
169
 
170
 
171
            json.append(orders.toJSONFragment());
172
            json.append("}");
173
            first = false;
174
        }
175
        return json.toString();
176
    }
177
 
178
    /**
179
     *
180
     * Quote JSON string
181
     */
182
    private String quoteJSON(String string) {
183
        if (string == null)
184
            return "null";
185
        StringBuffer sb = new StringBuffer();
186
        sb.append("\"");
187
        int length = string.length();
188
        for (int i = 0; i < length; ++i) {
189
            char c = string.charAt(i);
190
            switch (c) {
191
            case '"':
192
                sb.append("\\\"");
193
                break;
194
            case '\\':
195
                sb.append("\\\\");
196
                break;
197
            case '/':
198
                sb.append("\\/");
199
                break;
200
            case '\b':
201
                sb.append("\\b");
202
                break;
203
            case '\f':
204
                sb.append("\\f");
205
                break;
206
            case '\n':
207
                sb.append("\\n");
208
                break;
209
            case '\r':
210
                sb.append("\\r");
211
                break;
212
            case '\t':
213
                sb.append("\\t");
214
                break;
215
            default:
216
                if (c <  ' ') {
217
                    sb.append("\\u" + String.format("%03x", Integer.valueOf(c)));
218
                } else {
219
                sb.append(c);
220
            }
221
        }
222
        }
223
        sb.append("\"");
224
        return sb.toString();
225
    }
226
 
227
 
228
}