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