Subversion Repositories SmartDukaan

Rev

Rev 12573 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 12573 Rev 12576
Line 1... Line -...
1
Unexpected error.  File contents could not be restored from local history during undo/redo.
-
 
2
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.XmlType;
-
 
8
 
-
 
9
 
-
 
10
/**
-
 
11
 * <p>Java class for Money complex type.
-
 
12
 * 
-
 
13
 * <p>The following schema fragment specifies the expected content contained within this class.
-
 
14
 * 
-
 
15
 * <pre>
-
 
16
 * &lt;complexType name="Money">
-
 
17
 *   &lt;complexContent>
-
 
18
 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
-
 
19
 *       &lt;sequence>
-
 
20
 *         &lt;element name="CurrencyCode" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
-
 
21
 *         &lt;element name="Amount" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
-
 
22
 *       &lt;/sequence>
-
 
23
 *     &lt;/restriction>
-
 
24
 *   &lt;/complexContent>
-
 
25
 * &lt;/complexType>
-
 
26
 * </pre>
-
 
27
 * 
-
 
28
 * 
-
 
29
 */
-
 
30
@XmlAccessorType(XmlAccessType.FIELD)
-
 
31
@XmlType(name = "Money", propOrder = {
-
 
32
    "currencyCode",
-
 
33
    "amount"
-
 
34
})
-
 
35
public class Money {
-
 
36
 
-
 
37
    @XmlElement(name = "CurrencyCode")
-
 
38
    protected String currencyCode;
-
 
39
    @XmlElement(name = "Amount")
-
 
40
    protected String amount;
-
 
41
 
-
 
42
    /**
-
 
43
     * Default constructor
-
 
44
     * 
-
 
45
     */
-
 
46
    public Money() {
-
 
47
        super();
-
 
48
    }
-
 
49
 
-
 
50
    /**
-
 
51
     * Value constructor
-
 
52
     * 
-
 
53
     */
-
 
54
    public Money(final String currencyCode, final String amount) {
-
 
55
        this.currencyCode = currencyCode;
-
 
56
        this.amount = amount;
-
 
57
    }
-
 
58
 
-
 
59
    /**
-
 
60
     * Gets the value of the currencyCode property.
-
 
61
     * 
-
 
62
     * @return
-
 
63
     *     possible object is
-
 
64
     *     {@link String }
-
 
65
     *     
-
 
66
     */
-
 
67
    public String getCurrencyCode() {
-
 
68
        return currencyCode;
-
 
69
    }
-
 
70
 
-
 
71
    /**
-
 
72
     * Sets the value of the currencyCode property.
-
 
73
     * 
-
 
74
     * @param value
-
 
75
     *     allowed object is
-
 
76
     *     {@link String }
-
 
77
     *     
-
 
78
     */
-
 
79
    public void setCurrencyCode(String value) {
-
 
80
        this.currencyCode = value;
-
 
81
    }
-
 
82
 
-
 
83
    public boolean isSetCurrencyCode() {
-
 
84
        return (this.currencyCode!= null);
-
 
85
    }
-
 
86
 
-
 
87
    /**
-
 
88
     * Gets the value of the amount property.
-
 
89
     * 
-
 
90
     * @return
-
 
91
     *     possible object is
-
 
92
     *     {@link String }
-
 
93
     *     
-
 
94
     */
-
 
95
    public String getAmount() {
-
 
96
        return amount;
-
 
97
    }
-
 
98
 
-
 
99
    /**
-
 
100
     * Sets the value of the amount property.
-
 
101
     * 
-
 
102
     * @param value
-
 
103
     *     allowed object is
-
 
104
     *     {@link String }
-
 
105
     *     
-
 
106
     */
-
 
107
    public void setAmount(String value) {
-
 
108
        this.amount = value;
-
 
109
    }
-
 
110
 
-
 
111
    public boolean isSetAmount() {
-
 
112
        return (this.amount!= null);
-
 
113
    }
-
 
114
 
-
 
115
    /**
-
 
116
     * Sets the value of the CurrencyCode property.
-
 
117
     * 
-
 
118
     * @param value
-
 
119
     * @return
-
 
120
     *     this instance
-
 
121
     */
-
 
122
    public Money withCurrencyCode(String value) {
-
 
123
        setCurrencyCode(value);
-
 
124
        return this;
-
 
125
    }
-
 
126
 
-
 
127
    /**
-
 
128
     * Sets the value of the Amount property.
-
 
129
     * 
-
 
130
     * @param value
-
 
131
     * @return
-
 
132
     *     this instance
-
 
133
     */
-
 
134
    public Money withAmount(String value) {
-
 
135
        setAmount(value);
-
 
136
        return this;
-
 
137
    }
-
 
138
    
-
 
139
 
-
 
140
 
-
 
141
    /**
-
 
142
     * 
-
 
143
     * XML fragment representation of this object
-
 
144
     * 
-
 
145
     * @return XML fragment for this object. Name for outer
-
 
146
     * tag expected to be set by calling method. This fragment
-
 
147
     * returns inner properties representation only
-
 
148
     */
-
 
149
    public String toXMLFragment() {
-
 
150
        StringBuffer xml = new StringBuffer();
-
 
151
        if (isSetCurrencyCode()) {
-
 
152
            xml.append("<CurrencyCode>");
-
 
153
            xml.append(escapeXML(getCurrencyCode()));
-
 
154
            xml.append("</CurrencyCode>");
-
 
155
        }
-
 
156
        if (isSetAmount()) {
-
 
157
            xml.append("<Amount>");
-
 
158
            xml.append(escapeXML(getAmount()));
-
 
159
            xml.append("</Amount>");
-
 
160
        }
-
 
161
        return xml.toString();
-
 
162
    }
-
 
163
 
-
 
164
    /**
-
 
165
     * 
-
 
166
     * Escape XML special characters
-
 
167
     */
-
 
168
    private String escapeXML(String string) {
-
 
169
        if (string == null)
-
 
170
            return "null";
-
 
171
        StringBuffer sb = new StringBuffer();
-
 
172
        int length = string.length();
-
 
173
        for (int i = 0; i < length; ++i) {
-
 
174
            char c = string.charAt(i);
-
 
175
            switch (c) {
-
 
176
            case '&':
-
 
177
                sb.append("&amp;");
-
 
178
                break;
-
 
179
            case '<':
-
 
180
                sb.append("&lt;");
-
 
181
                break;
-
 
182
            case '>':
-
 
183
                sb.append("&gt;");
-
 
184
                break;
-
 
185
            case '\'':
-
 
186
                sb.append("&#039;");
-
 
187
                break;
-
 
188
            case '"':
-
 
189
                sb.append("&quot;");
-
 
190
                break;
-
 
191
            default:
-
 
192
                sb.append(c);
-
 
193
            }
-
 
194
        }
-
 
195
        return sb.toString();
-
 
196
    }
-
 
197
 
-
 
198
 
-
 
199
 
-
 
200
    /**
-
 
201
     *
-
 
202
     * JSON fragment representation of this object
-
 
203
     *
-
 
204
     * @return JSON fragment for this object. Name for outer
-
 
205
     * object expected to be set by calling method. This fragment
-
 
206
     * returns inner properties representation only
-
 
207
     *
-
 
208
     */
-
 
209
    protected String toJSONFragment() {
-
 
210
        StringBuffer json = new StringBuffer();
-
 
211
        boolean first = true;
-
 
212
        if (isSetCurrencyCode()) {
-
 
213
            if (!first) json.append(", ");
-
 
214
            json.append(quoteJSON("CurrencyCode"));
-
 
215
            json.append(" : ");
-
 
216
            json.append(quoteJSON(getCurrencyCode()));
-
 
217
            first = false;
-
 
218
        }
-
 
219
        if (isSetAmount()) {
-
 
220
            if (!first) json.append(", ");
-
 
221
            json.append(quoteJSON("Amount"));
-
 
222
            json.append(" : ");
-
 
223
            json.append(quoteJSON(getAmount()));
-
 
224
            first = false;
-
 
225
        }
-
 
226
        return json.toString();
-
 
227
    }
-
 
228
 
-
 
229
    /**
-
 
230
     *
-
 
231
     * Quote JSON string
-
 
232
     */
-
 
233
    private String quoteJSON(String string) {
-
 
234
        if (string == null)
-
 
235
            return "null";
-
 
236
        StringBuffer sb = new StringBuffer();
-
 
237
        sb.append("\"");
-
 
238
        int length = string.length();
-
 
239
        for (int i = 0; i < length; ++i) {
-
 
240
            char c = string.charAt(i);
-
 
241
            switch (c) {
-
 
242
            case '"':
-
 
243
                sb.append("\\\"");
-
 
244
                break;
-
 
245
            case '\\':
-
 
246
                sb.append("\\\\");
-
 
247
                break;
-
 
248
            case '/':
-
 
249
                sb.append("\\/");
-
 
250
                break;
-
 
251
            case '\b':
-
 
252
                sb.append("\\b");
-
 
253
                break;
-
 
254
            case '\f':
-
 
255
                sb.append("\\f");
-
 
256
                break;
-
 
257
            case '\n':
-
 
258
                sb.append("\\n");
-
 
259
                break;
-
 
260
            case '\r':
-
 
261
                sb.append("\\r");
-
 
262
                break;
-
 
263
            case '\t':
-
 
264
                sb.append("\\t");
-
 
265
                break;
-
 
266
            default:
-
 
267
                if (c <  ' ') {
-
 
268
                    sb.append("\\u" + String.format("%03x", Integer.valueOf(c)));
-
 
269
                } else {
-
 
270
                sb.append(c);
-
 
271
            }
-
 
272
        }
-
 
273
        }
-
 
274
        sb.append("\"");
-
 
275
        return sb.toString();
-
 
276
    }
-
 
277
 
-
 
278
 
-
 
279
}
-
 
280