Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
12451 kshitij.so 1
 
2
package com.amazonaws.mws.model;
3
 
4
import java.util.ArrayList;
5
import java.util.List;
6
import javax.xml.bind.annotation.XmlAccessType;
7
import javax.xml.bind.annotation.XmlAccessorType;
8
import javax.xml.bind.annotation.XmlElement;
9
import javax.xml.bind.annotation.XmlType;
10
 
11
 
12
/**
13
 * <p>Java class for StatusList complex type.
14
 * 
15
 * <p>The following schema fragment specifies the expected content contained within this class.
16
 * 
17
 * <pre>
18
 * &lt;complexType name="StatusList">
19
 *   &lt;complexContent>
20
 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
21
 *       &lt;sequence>
22
 *         &lt;element name="Status" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded"/>
23
 *       &lt;/sequence>
24
 *     &lt;/restriction>
25
 *   &lt;/complexContent>
26
 * &lt;/complexType>
27
 * </pre>
28
 * Generated by AWS Code Generator
29
 * <p/>
30
 * Wed Feb 18 13:28:59 PST 2009
31
 * 
32
 */
33
@XmlAccessorType(XmlAccessType.FIELD)
34
@XmlType(name = "StatusList", propOrder = {
35
    "status"
36
})
37
public class StatusList {
38
 
39
    @XmlElement(name = "Status", required = true)
40
    protected List<String> status;
41
 
42
    /**
43
     * Default constructor
44
     * 
45
     */
46
    public StatusList() {
47
        super();
48
    }
49
 
50
    /**
51
     * Value constructor
52
     * 
53
     */
54
    public StatusList(final List<String> status) {
55
        this.status = status;
56
    }
57
 
58
    /**
59
     * Gets the value of the status property.
60
     * 
61
     * <p>
62
     * This accessor method returns a reference to the live list,
63
     * not a snapshot. Therefore any modification you make to the
64
     * returned list will be present inside the JAXB object.
65
     * This is why there is not a <CODE>set</CODE> method for the status property.
66
     * 
67
     * <p>
68
     * For example, to add a new item, do as follows:
69
     * <pre>
70
     *    getStatus().add(newItem);
71
     * </pre>
72
     * 
73
     * 
74
     * <p>
75
     * Objects of the following type(s) are allowed in the list
76
     * {@link String }
77
     * 
78
     * 
79
     */
80
    public List<String> getStatus() {
81
        if (status == null) {
82
            status = new ArrayList<String>();
83
        }
84
        return this.status;
85
    }
86
 
87
    public boolean isSetStatus() {
88
        return ((this.status!= null)&&(!this.status.isEmpty()));
89
    }
90
 
91
    public void unsetStatus() {
92
        this.status = null;
93
    }
94
 
95
    /**
96
     * Sets the value of the Status property.
97
     * 
98
     * @param values
99
     * @return
100
     *     this instance
101
     */
102
    public StatusList withStatus(String... values) {
103
        for (String value: values) {
104
            getStatus().add(value);
105
        }
106
        return this;
107
    }
108
 
109
    /**
110
     * Sets the value of the status property.
111
     * 
112
     * @param status
113
     *     allowed object is
114
     *     {@link String }
115
     *     
116
     */
117
    public void setStatus(List<String> status) {
118
        this.status = status;
119
    }
120
 
121
 
122
    /**
123
     * 
124
     * XML fragment representation of this object
125
     * 
126
     * @return XML fragment for this object. Name for outer
127
     * tag expected to be set by calling method. This fragment
128
     * returns inner properties representation only
129
     */
130
    protected String toXMLFragment() {
131
        StringBuffer xml = new StringBuffer();
132
        java.util.List<String> statusList  =  getStatus();
133
        for (String status : statusList) { 
134
            xml.append("<Status>");
135
            xml.append(escapeXML(status));
136
            xml.append("</Status>");
137
        }	
138
        return xml.toString();
139
    }
140
 
141
    /**
142
     * 
143
     * Escape XML special characters
144
     */
145
    private String escapeXML(String string) {
146
        StringBuffer sb = new StringBuffer();
147
        int length = string.length();
148
        for (int i = 0; i < length; ++i) {
149
            char c = string.charAt(i);
150
            switch (c) {
151
            case '&':
152
                sb.append("&amp;");
153
                break;
154
            case '<':
155
                sb.append("&lt;");
156
                break;
157
            case '>':
158
                sb.append("&gt;");
159
                break;
160
            case '\'':
161
                sb.append("&#039;");
162
                break;
163
            case '"':
164
                sb.append("&quot;");
165
                break;
166
            default:
167
                sb.append(c);
168
            }
169
        }
170
        return sb.toString();
171
    }
172
 
173
 
174
 
175
    /**
176
     *
177
     * JSON fragment representation of this object
178
     *
179
     * @return JSON fragment for this object. Name for outer
180
     * object expected to be set by calling method. This fragment
181
     * returns inner properties representation only
182
     *
183
     */
184
    protected String toJSONFragment() {
185
        StringBuffer json = new StringBuffer();
186
        boolean first = true;
187
        if (isSetStatus()) {
188
            if (!first) json.append(", ");
189
            json.append("\"Status\" : [");
190
            java.util.List<String> statusList  =  getStatus();
191
            for (String status : statusList) {
192
                if (statusList.indexOf(status) > 0) json.append(", ");
193
                    json.append(quoteJSON(status));
194
            }
195
            json.append("]");
196
            first = false;
197
        }
198
        return json.toString();
199
    }
200
 
201
    /**
202
     *
203
     * Quote JSON string
204
     */
205
    private String quoteJSON(String string) {
206
        StringBuffer sb = new StringBuffer();
207
        sb.append("\"");
208
        int length = string.length();
209
        for (int i = 0; i < length; ++i) {
210
            char c = string.charAt(i);
211
            switch (c) {
212
            case '"':
213
                sb.append("\\\"");
214
                break;
215
            case '\\':
216
                sb.append("\\\\");
217
                break;
218
            case '/':
219
                sb.append("\\/");
220
                break;
221
            case '\b':
222
                sb.append("\\b");
223
                break;
224
            case '\f':
225
                sb.append("\\f");
226
                break;
227
            case '\n':
228
                sb.append("\\n");
229
                break;
230
            case '\r':
231
                sb.append("\\r");
232
                break;
233
            case '\t':
234
                sb.append("\\t");
235
                break;
236
            default:
237
                if (c <  ' ') {
238
                    sb.append("\\u" + String.format("%03x", Integer.valueOf(c)));
239
                } else {
240
                sb.append(c);
241
            }
242
        }
243
        }
244
        sb.append("\"");
245
        return sb.toString();
246
    }
247
 
248
 
249
}