Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
7474 vikram.rag 1
 
2
package com.amazonservices.mws.products.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 Product complex type.
12
 * 
13
 * <p>The following schema fragment specifies the expected content contained within this class.
14
 * 
15
 * <pre>
16
 * &lt;complexType name="Product">
17
 *   &lt;complexContent>
18
 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
19
 *       &lt;sequence>
20
 *         &lt;element name="Identifiers" type="{http://mws.amazonservices.com/schema/Products/2011-10-01}IdentifierType"/>
21
 *         &lt;element name="AttributeSets" type="{http://mws.amazonservices.com/schema/Products/2011-10-01}AttributeSetList" minOccurs="0"/>
22
 *         &lt;element name="Relationships" type="{http://mws.amazonservices.com/schema/Products/2011-10-01}RelationshipList" minOccurs="0"/>
23
 *         &lt;element name="CompetitivePricing" type="{http://mws.amazonservices.com/schema/Products/2011-10-01}CompetitivePricingType" minOccurs="0"/>
24
 *         &lt;element name="SalesRankings" type="{http://mws.amazonservices.com/schema/Products/2011-10-01}SalesRankList" minOccurs="0"/>
25
 *         &lt;element name="LowestOfferListings" type="{http://mws.amazonservices.com/schema/Products/2011-10-01}LowestOfferListingList" minOccurs="0"/>
26
 *         &lt;element name="Offers" type="{http://mws.amazonservices.com/schema/Products/2011-10-01}OffersList" minOccurs="0"/>
27
 *       &lt;/sequence>
28
 *     &lt;/restriction>
29
 *   &lt;/complexContent>
30
 * &lt;/complexType>
31
 * </pre>
32
 * 
33
 * 
34
 */
35
@XmlAccessorType(XmlAccessType.FIELD)
36
@XmlType(name = "Product", propOrder = {
37
    "identifiers",
38
    "attributeSets",
39
    "relationships",
40
    "competitivePricing",
41
    "salesRankings",
42
    "lowestOfferListings",
43
    "offers"
44
})
45
public class Product {
46
 
47
    @XmlElement(name = "Identifiers", required = true)
48
    protected IdentifierType identifiers;
49
    @XmlElement(name = "AttributeSets")
50
    protected AttributeSetList attributeSets;
51
    @XmlElement(name = "Relationships")
52
    protected RelationshipList relationships;
53
    @XmlElement(name = "CompetitivePricing")
54
    protected CompetitivePricingType competitivePricing;
55
    @XmlElement(name = "SalesRankings")
56
    protected SalesRankList salesRankings;
57
    @XmlElement(name = "LowestOfferListings")
58
    protected LowestOfferListingList lowestOfferListings;
59
    @XmlElement(name = "Offers")
60
    protected OffersList offers;
61
 
62
    /**
63
     * Default constructor
64
     * 
65
     */
66
    public Product() {
67
        super();
68
    }
69
 
70
    /**
71
     * Value constructor
72
     * 
73
     */
74
    public Product(final IdentifierType identifiers, final AttributeSetList attributeSets, final RelationshipList relationships, final CompetitivePricingType competitivePricing, final SalesRankList salesRankings, final LowestOfferListingList lowestOfferListings, final OffersList offers) {
75
        this.identifiers = identifiers;
76
        this.attributeSets = attributeSets;
77
        this.relationships = relationships;
78
        this.competitivePricing = competitivePricing;
79
        this.salesRankings = salesRankings;
80
        this.lowestOfferListings = lowestOfferListings;
81
        this.offers = offers;
82
    }
83
 
84
    /**
85
     * Gets the value of the identifiers property.
86
     * 
87
     * @return
88
     *     possible object is
89
     *     {@link IdentifierType }
90
     *     
91
     */
92
    public IdentifierType getIdentifiers() {
93
        return identifiers;
94
    }
95
 
96
    /**
97
     * Sets the value of the identifiers property.
98
     * 
99
     * @param value
100
     *     allowed object is
101
     *     {@link IdentifierType }
102
     *     
103
     */
104
    public void setIdentifiers(IdentifierType value) {
105
        this.identifiers = value;
106
    }
107
 
108
    public boolean isSetIdentifiers() {
109
        return (this.identifiers!= null);
110
    }
111
 
112
    /**
113
     * Gets the value of the attributeSets property.
114
     * 
115
     * @return
116
     *     possible object is
117
     *     {@link AttributeSetList }
118
     *     
119
     */
120
    public AttributeSetList getAttributeSets() {
121
        return attributeSets;
122
    }
123
 
124
    /**
125
     * Sets the value of the attributeSets property.
126
     * 
127
     * @param value
128
     *     allowed object is
129
     *     {@link AttributeSetList }
130
     *     
131
     */
132
    public void setAttributeSets(AttributeSetList value) {
133
        this.attributeSets = value;
134
    }
135
 
136
    public boolean isSetAttributeSets() {
137
        return (this.attributeSets!= null);
138
    }
139
 
140
    /**
141
     * Gets the value of the relationships property.
142
     * 
143
     * @return
144
     *     possible object is
145
     *     {@link RelationshipList }
146
     *     
147
     */
148
    public RelationshipList getRelationships() {
149
        return relationships;
150
    }
151
 
152
    /**
153
     * Sets the value of the relationships property.
154
     * 
155
     * @param value
156
     *     allowed object is
157
     *     {@link RelationshipList }
158
     *     
159
     */
160
    public void setRelationships(RelationshipList value) {
161
        this.relationships = value;
162
    }
163
 
164
    public boolean isSetRelationships() {
165
        return (this.relationships!= null);
166
    }
167
 
168
    /**
169
     * Gets the value of the competitivePricing property.
170
     * 
171
     * @return
172
     *     possible object is
173
     *     {@link CompetitivePricingType }
174
     *     
175
     */
176
    public CompetitivePricingType getCompetitivePricing() {
177
        return competitivePricing;
178
    }
179
 
180
    /**
181
     * Sets the value of the competitivePricing property.
182
     * 
183
     * @param value
184
     *     allowed object is
185
     *     {@link CompetitivePricingType }
186
     *     
187
     */
188
    public void setCompetitivePricing(CompetitivePricingType value) {
189
        this.competitivePricing = value;
190
    }
191
 
192
    public boolean isSetCompetitivePricing() {
193
        return (this.competitivePricing!= null);
194
    }
195
 
196
    /**
197
     * Gets the value of the salesRankings property.
198
     * 
199
     * @return
200
     *     possible object is
201
     *     {@link SalesRankList }
202
     *     
203
     */
204
    public SalesRankList getSalesRankings() {
205
        return salesRankings;
206
    }
207
 
208
    /**
209
     * Sets the value of the salesRankings property.
210
     * 
211
     * @param value
212
     *     allowed object is
213
     *     {@link SalesRankList }
214
     *     
215
     */
216
    public void setSalesRankings(SalesRankList value) {
217
        this.salesRankings = value;
218
    }
219
 
220
    public boolean isSetSalesRankings() {
221
        return (this.salesRankings!= null);
222
    }
223
 
224
    /**
225
     * Gets the value of the lowestOfferListings property.
226
     * 
227
     * @return
228
     *     possible object is
229
     *     {@link LowestOfferListingList }
230
     *     
231
     */
232
    public LowestOfferListingList getLowestOfferListings() {
233
        return lowestOfferListings;
234
    }
235
 
236
    /**
237
     * Sets the value of the lowestOfferListings property.
238
     * 
239
     * @param value
240
     *     allowed object is
241
     *     {@link LowestOfferListingList }
242
     *     
243
     */
244
    public void setLowestOfferListings(LowestOfferListingList value) {
245
        this.lowestOfferListings = value;
246
    }
247
 
248
    public boolean isSetLowestOfferListings() {
249
        return (this.lowestOfferListings!= null);
250
    }
251
 
252
    /**
253
     * Gets the value of the offers property.
254
     * 
255
     * @return
256
     *     possible object is
257
     *     {@link OffersList }
258
     *     
259
     */
260
    public OffersList getOffers() {
261
        return offers;
262
    }
263
 
264
    /**
265
     * Sets the value of the offers property.
266
     * 
267
     * @param value
268
     *     allowed object is
269
     *     {@link OffersList }
270
     *     
271
     */
272
    public void setOffers(OffersList value) {
273
        this.offers = value;
274
    }
275
 
276
    public boolean isSetOffers() {
277
        return (this.offers!= null);
278
    }
279
 
280
    /**
281
     * Sets the value of the Identifiers property.
282
     * 
283
     * @param value
284
     * @return
285
     *     this instance
286
     */
287
    public Product withIdentifiers(IdentifierType value) {
288
        setIdentifiers(value);
289
        return this;
290
    }
291
 
292
    /**
293
     * Sets the value of the AttributeSets property.
294
     * 
295
     * @param value
296
     * @return
297
     *     this instance
298
     */
299
    public Product withAttributeSets(AttributeSetList value) {
300
        setAttributeSets(value);
301
        return this;
302
    }
303
 
304
    /**
305
     * Sets the value of the Relationships property.
306
     * 
307
     * @param value
308
     * @return
309
     *     this instance
310
     */
311
    public Product withRelationships(RelationshipList value) {
312
        setRelationships(value);
313
        return this;
314
    }
315
 
316
    /**
317
     * Sets the value of the CompetitivePricing property.
318
     * 
319
     * @param value
320
     * @return
321
     *     this instance
322
     */
323
    public Product withCompetitivePricing(CompetitivePricingType value) {
324
        setCompetitivePricing(value);
325
        return this;
326
    }
327
 
328
    /**
329
     * Sets the value of the SalesRankings property.
330
     * 
331
     * @param value
332
     * @return
333
     *     this instance
334
     */
335
    public Product withSalesRankings(SalesRankList value) {
336
        setSalesRankings(value);
337
        return this;
338
    }
339
 
340
    /**
341
     * Sets the value of the LowestOfferListings property.
342
     * 
343
     * @param value
344
     * @return
345
     *     this instance
346
     */
347
    public Product withLowestOfferListings(LowestOfferListingList value) {
348
        setLowestOfferListings(value);
349
        return this;
350
    }
351
 
352
    /**
353
     * Sets the value of the Offers property.
354
     * 
355
     * @param value
356
     * @return
357
     *     this instance
358
     */
359
    public Product withOffers(OffersList value) {
360
        setOffers(value);
361
        return this;
362
    }
363
 
364
 
365
 
366
    /**
367
     * 
368
     * XML fragment representation of this object
369
     * 
370
     * @return XML fragment for this object. Name for outer
371
     * tag expected to be set by calling method. This fragment
372
     * returns inner properties representation only
373
     */
374
    public String toXMLFragment() {
375
        StringBuffer xml = new StringBuffer();
376
        if (isSetIdentifiers()) {
377
            IdentifierType  identifiers = getIdentifiers();
378
            xml.append("<Identifiers>");
379
            xml.append(identifiers.toXMLFragment());
380
            xml.append("</Identifiers>");
381
        } 
382
        if (isSetAttributeSets()) {
383
            AttributeSetList  attributeSets = getAttributeSets();
384
            xml.append("<AttributeSets>");
385
            xml.append(attributeSets.toXMLFragment());
386
            xml.append("</AttributeSets>");
387
        } 
388
        if (isSetRelationships()) {
389
            RelationshipList  relationships = getRelationships();
390
            xml.append("<Relationships>");
391
            xml.append(relationships.toXMLFragment());
392
            xml.append("</Relationships>");
393
        } 
394
        if (isSetCompetitivePricing()) {
395
            CompetitivePricingType  competitivePricing = getCompetitivePricing();
396
            xml.append("<CompetitivePricing>");
397
            xml.append(competitivePricing.toXMLFragment());
398
            xml.append("</CompetitivePricing>");
399
        } 
400
        if (isSetSalesRankings()) {
401
            SalesRankList  salesRankings = getSalesRankings();
402
            xml.append("<SalesRankings>");
403
            xml.append(salesRankings.toXMLFragment());
404
            xml.append("</SalesRankings>");
405
        } 
406
        if (isSetLowestOfferListings()) {
407
            LowestOfferListingList  lowestOfferListings = getLowestOfferListings();
408
            xml.append("<LowestOfferListings>");
409
            xml.append(lowestOfferListings.toXMLFragment());
410
            xml.append("</LowestOfferListings>");
411
        } 
412
        if (isSetOffers()) {
413
            OffersList  offers = getOffers();
414
            xml.append("<Offers>");
415
            xml.append(offers.toXMLFragment());
416
            xml.append("</Offers>");
417
        } 
418
        return xml.toString();
419
    }
420
 
421
    /**
422
     * 
423
     * Escape XML special characters
424
     */
425
    private String escapeXML(String string) {
426
        if (string == null)
427
            return "null";
428
        StringBuffer sb = new StringBuffer();
429
        int length = string.length();
430
        for (int i = 0; i < length; ++i) {
431
            char c = string.charAt(i);
432
            switch (c) {
433
            case '&':
434
                sb.append("&amp;");
435
                break;
436
            case '<':
437
                sb.append("&lt;");
438
                break;
439
            case '>':
440
                sb.append("&gt;");
441
                break;
442
            case '\'':
443
                sb.append("&#039;");
444
                break;
445
            case '"':
446
                sb.append("&quot;");
447
                break;
448
            default:
449
                sb.append(c);
450
            }
451
        }
452
        return sb.toString();
453
    }
454
 
455
 
456
 
457
    /**
458
     *
459
     * JSON fragment representation of this object
460
     *
461
     * @return JSON fragment for this object. Name for outer
462
     * object expected to be set by calling method. This fragment
463
     * returns inner properties representation only
464
     *
465
     */
466
    protected String toJSONFragment() {
467
        StringBuffer json = new StringBuffer();
468
        boolean first = true;
469
        if (isSetIdentifiers()) {
470
            if (!first) json.append(", ");
471
            json.append("\"Identifiers\" : {");
472
            IdentifierType  identifiers = getIdentifiers();
473
 
474
 
475
            json.append(identifiers.toJSONFragment());
476
            json.append("}");
477
            first = false;
478
        }
479
        if (isSetAttributeSets()) {
480
            if (!first) json.append(", ");
481
            json.append("\"AttributeSets\" : {");
482
            AttributeSetList  attributeSets = getAttributeSets();
483
 
484
 
485
            json.append(attributeSets.toJSONFragment());
486
            json.append("}");
487
            first = false;
488
        }
489
        if (isSetRelationships()) {
490
            if (!first) json.append(", ");
491
            json.append("\"Relationships\" : {");
492
            RelationshipList  relationships = getRelationships();
493
 
494
 
495
            json.append(relationships.toJSONFragment());
496
            json.append("}");
497
            first = false;
498
        }
499
        if (isSetCompetitivePricing()) {
500
            if (!first) json.append(", ");
501
            json.append("\"CompetitivePricing\" : {");
502
            CompetitivePricingType  competitivePricing = getCompetitivePricing();
503
 
504
 
505
            json.append(competitivePricing.toJSONFragment());
506
            json.append("}");
507
            first = false;
508
        }
509
        if (isSetSalesRankings()) {
510
            if (!first) json.append(", ");
511
            json.append("\"SalesRankings\" : {");
512
            SalesRankList  salesRankings = getSalesRankings();
513
 
514
 
515
            json.append(salesRankings.toJSONFragment());
516
            json.append("}");
517
            first = false;
518
        }
519
        if (isSetLowestOfferListings()) {
520
            if (!first) json.append(", ");
521
            json.append("\"LowestOfferListings\" : {");
522
            LowestOfferListingList  lowestOfferListings = getLowestOfferListings();
523
 
524
 
525
            json.append(lowestOfferListings.toJSONFragment());
526
            json.append("}");
527
            first = false;
528
        }
529
        if (isSetOffers()) {
530
            if (!first) json.append(", ");
531
            json.append("\"Offers\" : {");
532
            OffersList  offers = getOffers();
533
 
534
 
535
            json.append(offers.toJSONFragment());
536
            json.append("}");
537
            first = false;
538
        }
539
        return json.toString();
540
    }
541
 
542
    /**
543
     *
544
     * Quote JSON string
545
     */
546
    private String quoteJSON(String string) {
547
        if (string == null)
548
            return "null";
549
        StringBuffer sb = new StringBuffer();
550
        sb.append("\"");
551
        int length = string.length();
552
        for (int i = 0; i < length; ++i) {
553
            char c = string.charAt(i);
554
            switch (c) {
555
            case '"':
556
                sb.append("\\\"");
557
                break;
558
            case '\\':
559
                sb.append("\\\\");
560
                break;
561
            case '/':
562
                sb.append("\\/");
563
                break;
564
            case '\b':
565
                sb.append("\\b");
566
                break;
567
            case '\f':
568
                sb.append("\\f");
569
                break;
570
            case '\n':
571
                sb.append("\\n");
572
                break;
573
            case '\r':
574
                sb.append("\\r");
575
                break;
576
            case '\t':
577
                sb.append("\\t");
578
                break;
579
            default:
580
                if (c <  ' ') {
581
                    sb.append("\\u" + String.format("%03x", Integer.valueOf(c)));
582
                } else {
583
                sb.append(c);
584
            }
585
        }
586
        }
587
        sb.append("\"");
588
        return sb.toString();
589
    }
590
 
591
 
592
}