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.XmlType;
8
 
9
 
10
/**
11
 * <p>Java class for Address complex type.
12
 * 
13
 * <p>The following schema fragment specifies the expected content contained within this class.
14
 * 
15
 * <pre>
16
 * &lt;complexType name="Address">
17
 *   &lt;complexContent>
18
 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
19
 *       &lt;sequence>
20
 *         &lt;element name="Name" type="{http://www.w3.org/2001/XMLSchema}string"/>
21
 *         &lt;element name="AddressLine1" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
22
 *         &lt;element name="AddressLine2" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
23
 *         &lt;element name="AddressLine3" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
24
 *         &lt;element name="City" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
25
 *         &lt;element name="County" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
26
 *         &lt;element name="District" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
27
 *         &lt;element name="StateOrRegion" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
28
 *         &lt;element name="PostalCode" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
29
 *         &lt;element name="CountryCode" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
30
 *         &lt;element name="Phone" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
31
 *       &lt;/sequence>
32
 *     &lt;/restriction>
33
 *   &lt;/complexContent>
34
 * &lt;/complexType>
35
 * </pre>
36
 * 
37
 * 
38
 */
39
@XmlAccessorType(XmlAccessType.FIELD)
40
@XmlType(name = "Address", propOrder = {
41
    "name",
42
    "addressLine1",
43
    "addressLine2",
44
    "addressLine3",
45
    "city",
46
    "county",
47
    "district",
48
    "stateOrRegion",
49
    "postalCode",
50
    "countryCode",
51
    "phone"
52
})
53
public class Address {
54
 
55
    @XmlElement(name = "Name", required = true)
56
    protected String name;
57
    @XmlElement(name = "AddressLine1")
58
    protected String addressLine1;
59
    @XmlElement(name = "AddressLine2")
60
    protected String addressLine2;
61
    @XmlElement(name = "AddressLine3")
62
    protected String addressLine3;
63
    @XmlElement(name = "City")
64
    protected String city;
65
    @XmlElement(name = "County")
66
    protected String county;
67
    @XmlElement(name = "District")
68
    protected String district;
69
    @XmlElement(name = "StateOrRegion")
70
    protected String stateOrRegion;
71
    @XmlElement(name = "PostalCode")
72
    protected String postalCode;
73
    @XmlElement(name = "CountryCode")
74
    protected String countryCode;
75
    @XmlElement(name = "Phone")
76
    protected String phone;
77
 
78
    /**
79
     * Default constructor
80
     * 
81
     */
82
    public Address() {
83
        super();
84
    }
85
 
86
    /**
87
     * Value constructor
88
     * 
89
     */
90
    public Address(final String name, final String addressLine1, final String addressLine2, final String addressLine3, final String city, final String county, final String district, final String stateOrRegion, final String postalCode, final String countryCode, final String phone) {
91
        this.name = name;
92
        this.addressLine1 = addressLine1;
93
        this.addressLine2 = addressLine2;
94
        this.addressLine3 = addressLine3;
95
        this.city = city;
96
        this.county = county;
97
        this.district = district;
98
        this.stateOrRegion = stateOrRegion;
99
        this.postalCode = postalCode;
100
        this.countryCode = countryCode;
101
        this.phone = phone;
102
    }
103
 
104
    /**
105
     * Gets the value of the name property.
106
     * 
107
     * @return
108
     *     possible object is
109
     *     {@link String }
110
     *     
111
     */
112
    public String getName() {
113
        return name;
114
    }
115
 
116
    /**
117
     * Sets the value of the name property.
118
     * 
119
     * @param value
120
     *     allowed object is
121
     *     {@link String }
122
     *     
123
     */
124
    public void setName(String value) {
125
        this.name = value;
126
    }
127
 
128
    public boolean isSetName() {
129
        return (this.name!= null);
130
    }
131
 
132
    /**
133
     * Gets the value of the addressLine1 property.
134
     * 
135
     * @return
136
     *     possible object is
137
     *     {@link String }
138
     *     
139
     */
140
    public String getAddressLine1() {
141
        return addressLine1;
142
    }
143
 
144
    /**
145
     * Sets the value of the addressLine1 property.
146
     * 
147
     * @param value
148
     *     allowed object is
149
     *     {@link String }
150
     *     
151
     */
152
    public void setAddressLine1(String value) {
153
        this.addressLine1 = value;
154
    }
155
 
156
    public boolean isSetAddressLine1() {
157
        return (this.addressLine1 != null);
158
    }
159
 
160
    /**
161
     * Gets the value of the addressLine2 property.
162
     * 
163
     * @return
164
     *     possible object is
165
     *     {@link String }
166
     *     
167
     */
168
    public String getAddressLine2() {
169
        return addressLine2;
170
    }
171
 
172
    /**
173
     * Sets the value of the addressLine2 property.
174
     * 
175
     * @param value
176
     *     allowed object is
177
     *     {@link String }
178
     *     
179
     */
180
    public void setAddressLine2(String value) {
181
        this.addressLine2 = value;
182
    }
183
 
184
    public boolean isSetAddressLine2() {
185
        return (this.addressLine2 != null);
186
    }
187
 
188
    /**
189
     * Gets the value of the addressLine3 property.
190
     * 
191
     * @return
192
     *     possible object is
193
     *     {@link String }
194
     *     
195
     */
196
    public String getAddressLine3() {
197
        return addressLine3;
198
    }
199
 
200
    /**
201
     * Sets the value of the addressLine3 property.
202
     * 
203
     * @param value
204
     *     allowed object is
205
     *     {@link String }
206
     *     
207
     */
208
    public void setAddressLine3(String value) {
209
        this.addressLine3 = value;
210
    }
211
 
212
    public boolean isSetAddressLine3() {
213
        return (this.addressLine3 != null);
214
    }
215
 
216
    /**
217
     * Gets the value of the city property.
218
     * 
219
     * @return
220
     *     possible object is
221
     *     {@link String }
222
     *     
223
     */
224
    public String getCity() {
225
        return city;
226
    }
227
 
228
    /**
229
     * Sets the value of the city property.
230
     * 
231
     * @param value
232
     *     allowed object is
233
     *     {@link String }
234
     *     
235
     */
236
    public void setCity(String value) {
237
        this.city = value;
238
    }
239
 
240
    public boolean isSetCity() {
241
        return (this.city!= null);
242
    }
243
 
244
    /**
245
     * Gets the value of the county property.
246
     * 
247
     * @return
248
     *     possible object is
249
     *     {@link String }
250
     *     
251
     */
252
    public String getCounty() {
253
        return county;
254
    }
255
 
256
    /**
257
     * Sets the value of the county property.
258
     * 
259
     * @param value
260
     *     allowed object is
261
     *     {@link String }
262
     *     
263
     */
264
    public void setCounty(String value) {
265
        this.county = value;
266
    }
267
 
268
    public boolean isSetCounty() {
269
        return (this.county!= null);
270
    }
271
 
272
    /**
273
     * Gets the value of the district property.
274
     * 
275
     * @return
276
     *     possible object is
277
     *     {@link String }
278
     *     
279
     */
280
    public String getDistrict() {
281
        return district;
282
    }
283
 
284
    /**
285
     * Sets the value of the district property.
286
     * 
287
     * @param value
288
     *     allowed object is
289
     *     {@link String }
290
     *     
291
     */
292
    public void setDistrict(String value) {
293
        this.district = value;
294
    }
295
 
296
    public boolean isSetDistrict() {
297
        return (this.district!= null);
298
    }
299
 
300
    /**
301
     * Gets the value of the stateOrRegion property.
302
     * 
303
     * @return
304
     *     possible object is
305
     *     {@link String }
306
     *     
307
     */
308
    public String getStateOrRegion() {
309
        return stateOrRegion;
310
    }
311
 
312
    /**
313
     * Sets the value of the stateOrRegion property.
314
     * 
315
     * @param value
316
     *     allowed object is
317
     *     {@link String }
318
     *     
319
     */
320
    public void setStateOrRegion(String value) {
321
        this.stateOrRegion = value;
322
    }
323
 
324
    public boolean isSetStateOrRegion() {
325
        return (this.stateOrRegion!= null);
326
    }
327
 
328
    /**
329
     * Gets the value of the postalCode property.
330
     * 
331
     * @return
332
     *     possible object is
333
     *     {@link String }
334
     *     
335
     */
336
    public String getPostalCode() {
337
        return postalCode;
338
    }
339
 
340
    /**
341
     * Sets the value of the postalCode property.
342
     * 
343
     * @param value
344
     *     allowed object is
345
     *     {@link String }
346
     *     
347
     */
348
    public void setPostalCode(String value) {
349
        this.postalCode = value;
350
    }
351
 
352
    public boolean isSetPostalCode() {
353
        return (this.postalCode!= null);
354
    }
355
 
356
    /**
357
     * Gets the value of the countryCode property.
358
     * 
359
     * @return
360
     *     possible object is
361
     *     {@link String }
362
     *     
363
     */
364
    public String getCountryCode() {
365
        return countryCode;
366
    }
367
 
368
    /**
369
     * Sets the value of the countryCode property.
370
     * 
371
     * @param value
372
     *     allowed object is
373
     *     {@link String }
374
     *     
375
     */
376
    public void setCountryCode(String value) {
377
        this.countryCode = value;
378
    }
379
 
380
    public boolean isSetCountryCode() {
381
        return (this.countryCode!= null);
382
    }
383
 
384
    /**
385
     * Gets the value of the phone property.
386
     * 
387
     * @return
388
     *     possible object is
389
     *     {@link String }
390
     *     
391
     */
392
    public String getPhone() {
393
        return phone;
394
    }
395
 
396
    /**
397
     * Sets the value of the phone property.
398
     * 
399
     * @param value
400
     *     allowed object is
401
     *     {@link String }
402
     *     
403
     */
404
    public void setPhone(String value) {
405
        this.phone = value;
406
    }
407
 
408
    public boolean isSetPhone() {
409
        return (this.phone!= null);
410
    }
411
 
412
    /**
413
     * Sets the value of the Name property.
414
     * 
415
     * @param value
416
     * @return
417
     *     this instance
418
     */
419
    public Address withName(String value) {
420
        setName(value);
421
        return this;
422
    }
423
 
424
    /**
425
     * Sets the value of the AddressLine1 property.
426
     * 
427
     * @param value
428
     * @return
429
     *     this instance
430
     */
431
    public Address withAddressLine1(String value) {
432
        setAddressLine1(value);
433
        return this;
434
    }
435
 
436
    /**
437
     * Sets the value of the AddressLine2 property.
438
     * 
439
     * @param value
440
     * @return
441
     *     this instance
442
     */
443
    public Address withAddressLine2(String value) {
444
        setAddressLine2(value);
445
        return this;
446
    }
447
 
448
    /**
449
     * Sets the value of the AddressLine3 property.
450
     * 
451
     * @param value
452
     * @return
453
     *     this instance
454
     */
455
    public Address withAddressLine3(String value) {
456
        setAddressLine3(value);
457
        return this;
458
    }
459
 
460
    /**
461
     * Sets the value of the City property.
462
     * 
463
     * @param value
464
     * @return
465
     *     this instance
466
     */
467
    public Address withCity(String value) {
468
        setCity(value);
469
        return this;
470
    }
471
 
472
    /**
473
     * Sets the value of the County property.
474
     * 
475
     * @param value
476
     * @return
477
     *     this instance
478
     */
479
    public Address withCounty(String value) {
480
        setCounty(value);
481
        return this;
482
    }
483
 
484
    /**
485
     * Sets the value of the District property.
486
     * 
487
     * @param value
488
     * @return
489
     *     this instance
490
     */
491
    public Address withDistrict(String value) {
492
        setDistrict(value);
493
        return this;
494
    }
495
 
496
    /**
497
     * Sets the value of the StateOrRegion property.
498
     * 
499
     * @param value
500
     * @return
501
     *     this instance
502
     */
503
    public Address withStateOrRegion(String value) {
504
        setStateOrRegion(value);
505
        return this;
506
    }
507
 
508
    /**
509
     * Sets the value of the PostalCode property.
510
     * 
511
     * @param value
512
     * @return
513
     *     this instance
514
     */
515
    public Address withPostalCode(String value) {
516
        setPostalCode(value);
517
        return this;
518
    }
519
 
520
    /**
521
     * Sets the value of the CountryCode property.
522
     * 
523
     * @param value
524
     * @return
525
     *     this instance
526
     */
527
    public Address withCountryCode(String value) {
528
        setCountryCode(value);
529
        return this;
530
    }
531
 
532
    /**
533
     * Sets the value of the Phone property.
534
     * 
535
     * @param value
536
     * @return
537
     *     this instance
538
     */
539
    public Address withPhone(String value) {
540
        setPhone(value);
541
        return this;
542
    }
543
 
544
 
545
 
546
    /**
547
     * 
548
     * XML fragment representation of this object
549
     * 
550
     * @return XML fragment for this object. Name for outer
551
     * tag expected to be set by calling method. This fragment
552
     * returns inner properties representation only
553
     */
554
    public String toXMLFragment() {
555
        StringBuffer xml = new StringBuffer();
556
        if (isSetName()) {
557
            xml.append("<Name>");
558
            xml.append(escapeXML(getName()));
559
            xml.append("</Name>");
560
        }
561
        if (isSetAddressLine1()) {
562
            xml.append("<AddressLine1>");
563
            xml.append(escapeXML(getAddressLine1()));
564
            xml.append("</AddressLine1>");
565
        }
566
        if (isSetAddressLine2()) {
567
            xml.append("<AddressLine2>");
568
            xml.append(escapeXML(getAddressLine2()));
569
            xml.append("</AddressLine2>");
570
        }
571
        if (isSetAddressLine3()) {
572
            xml.append("<AddressLine3>");
573
            xml.append(escapeXML(getAddressLine3()));
574
            xml.append("</AddressLine3>");
575
        }
576
        if (isSetCity()) {
577
            xml.append("<City>");
578
            xml.append(escapeXML(getCity()));
579
            xml.append("</City>");
580
        }
581
        if (isSetCounty()) {
582
            xml.append("<County>");
583
            xml.append(escapeXML(getCounty()));
584
            xml.append("</County>");
585
        }
586
        if (isSetDistrict()) {
587
            xml.append("<District>");
588
            xml.append(escapeXML(getDistrict()));
589
            xml.append("</District>");
590
        }
591
        if (isSetStateOrRegion()) {
592
            xml.append("<StateOrRegion>");
593
            xml.append(escapeXML(getStateOrRegion()));
594
            xml.append("</StateOrRegion>");
595
        }
596
        if (isSetPostalCode()) {
597
            xml.append("<PostalCode>");
598
            xml.append(escapeXML(getPostalCode()));
599
            xml.append("</PostalCode>");
600
        }
601
        if (isSetCountryCode()) {
602
            xml.append("<CountryCode>");
603
            xml.append(escapeXML(getCountryCode()));
604
            xml.append("</CountryCode>");
605
        }
606
        if (isSetPhone()) {
607
            xml.append("<Phone>");
608
            xml.append(escapeXML(getPhone()));
609
            xml.append("</Phone>");
610
        }
611
        return xml.toString();
612
    }
613
 
614
    /**
615
     * 
616
     * Escape XML special characters
617
     */
618
    private String escapeXML(String string) {
619
        if (string == null)
620
            return "null";
621
        StringBuffer sb = new StringBuffer();
622
        int length = string.length();
623
        for (int i = 0; i < length; ++i) {
624
            char c = string.charAt(i);
625
            switch (c) {
626
            case '&':
627
                sb.append("&amp;");
628
                break;
629
            case '<':
630
                sb.append("&lt;");
631
                break;
632
            case '>':
633
                sb.append("&gt;");
634
                break;
635
            case '\'':
636
                sb.append("&#039;");
637
                break;
638
            case '"':
639
                sb.append("&quot;");
640
                break;
641
            default:
642
                sb.append(c);
643
            }
644
        }
645
        return sb.toString();
646
    }
647
 
648
 
649
 
650
    /**
651
     *
652
     * JSON fragment representation of this object
653
     *
654
     * @return JSON fragment for this object. Name for outer
655
     * object expected to be set by calling method. This fragment
656
     * returns inner properties representation only
657
     *
658
     */
659
    protected String toJSONFragment() {
660
        StringBuffer json = new StringBuffer();
661
        boolean first = true;
662
        if (isSetName()) {
663
            if (!first) json.append(", ");
664
            json.append(quoteJSON("Name"));
665
            json.append(" : ");
666
            json.append(quoteJSON(getName()));
667
            first = false;
668
        }
669
        if (isSetAddressLine1()) {
670
            if (!first) json.append(", ");
671
            json.append(quoteJSON("AddressLine1"));
672
            json.append(" : ");
673
            json.append(quoteJSON(getAddressLine1()));
674
            first = false;
675
        }
676
        if (isSetAddressLine2()) {
677
            if (!first) json.append(", ");
678
            json.append(quoteJSON("AddressLine2"));
679
            json.append(" : ");
680
            json.append(quoteJSON(getAddressLine2()));
681
            first = false;
682
        }
683
        if (isSetAddressLine3()) {
684
            if (!first) json.append(", ");
685
            json.append(quoteJSON("AddressLine3"));
686
            json.append(" : ");
687
            json.append(quoteJSON(getAddressLine3()));
688
            first = false;
689
        }
690
        if (isSetCity()) {
691
            if (!first) json.append(", ");
692
            json.append(quoteJSON("City"));
693
            json.append(" : ");
694
            json.append(quoteJSON(getCity()));
695
            first = false;
696
        }
697
        if (isSetCounty()) {
698
            if (!first) json.append(", ");
699
            json.append(quoteJSON("County"));
700
            json.append(" : ");
701
            json.append(quoteJSON(getCounty()));
702
            first = false;
703
        }
704
        if (isSetDistrict()) {
705
            if (!first) json.append(", ");
706
            json.append(quoteJSON("District"));
707
            json.append(" : ");
708
            json.append(quoteJSON(getDistrict()));
709
            first = false;
710
        }
711
        if (isSetStateOrRegion()) {
712
            if (!first) json.append(", ");
713
            json.append(quoteJSON("StateOrRegion"));
714
            json.append(" : ");
715
            json.append(quoteJSON(getStateOrRegion()));
716
            first = false;
717
        }
718
        if (isSetPostalCode()) {
719
            if (!first) json.append(", ");
720
            json.append(quoteJSON("PostalCode"));
721
            json.append(" : ");
722
            json.append(quoteJSON(getPostalCode()));
723
            first = false;
724
        }
725
        if (isSetCountryCode()) {
726
            if (!first) json.append(", ");
727
            json.append(quoteJSON("CountryCode"));
728
            json.append(" : ");
729
            json.append(quoteJSON(getCountryCode()));
730
            first = false;
731
        }
732
        if (isSetPhone()) {
733
            if (!first) json.append(", ");
734
            json.append(quoteJSON("Phone"));
735
            json.append(" : ");
736
            json.append(quoteJSON(getPhone()));
737
            first = false;
738
        }
739
        return json.toString();
740
    }
741
 
742
    /**
743
     *
744
     * Quote JSON string
745
     */
746
    private String quoteJSON(String string) {
747
        if (string == null)
748
            return "null";
749
        StringBuffer sb = new StringBuffer();
750
        sb.append("\"");
751
        int length = string.length();
752
        for (int i = 0; i < length; ++i) {
753
            char c = string.charAt(i);
754
            switch (c) {
755
            case '"':
756
                sb.append("\\\"");
757
                break;
758
            case '\\':
759
                sb.append("\\\\");
760
                break;
761
            case '/':
762
                sb.append("\\/");
763
                break;
764
            case '\b':
765
                sb.append("\\b");
766
                break;
767
            case '\f':
768
                sb.append("\\f");
769
                break;
770
            case '\n':
771
                sb.append("\\n");
772
                break;
773
            case '\r':
774
                sb.append("\\r");
775
                break;
776
            case '\t':
777
                sb.append("\\t");
778
                break;
779
            default:
780
                if (c <  ' ') {
781
                    sb.append("\\u" + String.format("%03x", Integer.valueOf(c)));
782
                } else {
783
                sb.append(c);
784
            }
785
        }
786
        }
787
        sb.append("\"");
788
        return sb.toString();
789
    }
790
 
791
 
792
}