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