KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > collections > ship > sentity > Supplier


1 /*-
2  * See the file LICENSE for redistribution information.
3  *
4  * Copyright (c) 2002,2006 Oracle. All rights reserved.
5  *
6  * $Id: Supplier.java,v 1.11 2006/10/30 21:14:02 bostic Exp $
7  */

8
9 package collections.ship.sentity;
10
11 import java.io.Serializable JavaDoc;
12
13 /**
14  * A Supplier represents the combined key/data pair for a supplier entity.
15  *
16  * <p> In this sample, Supplier is created from the stored key/data entry
17  * using TupleSerialEntityBinding. See {@link SampleViews.PartBinding} for
18  * details.
19  * </p>
20  *
21  * <p> The binding is "tricky" in that it uses this class for both the stored
22  * data entry and the combined entity object. To do this, the key field(s) are
23  * transient and are set by the binding after the data object has been
24  * deserialized. This avoids the use of a SupplierData class completely. </p>
25  *
26  * <p> Since this class is used directly for data storage, it must be
27  * Serializable. </p>
28  *
29  * @author Mark Hayes
30  */

31 public class Supplier implements Serializable JavaDoc {
32
33     private transient String JavaDoc number;
34     private String JavaDoc name;
35     private int status;
36     private String JavaDoc city;
37
38     public Supplier(String JavaDoc number, String JavaDoc name, int status, String JavaDoc city) {
39
40         this.number = number;
41         this.name = name;
42         this.status = status;
43         this.city = city;
44     }
45
46     /**
47      * Set the transient key fields after deserializing. This method is only
48      * called by data bindings.
49      */

50     void setKey(String JavaDoc number) {
51
52         this.number = number;
53     }
54
55     public final String JavaDoc getNumber() {
56
57         return number;
58     }
59
60     public final String JavaDoc getName() {
61
62         return name;
63     }
64
65     public final int getStatus() {
66
67         return status;
68     }
69
70     public final String JavaDoc getCity() {
71
72         return city;
73     }
74
75     public String JavaDoc toString() {
76
77         return "[Supplier: number=" + number +
78                " name=" + name +
79                " status=" + status +
80                " city=" + city + ']';
81     }
82 }
83
Popular Tags