KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > sample > RecordImpl


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 package sample;
25
26 import javax.resource.cci.*;
27 import java.io.Serializable JavaDoc;
28 import java.io.IOException JavaDoc;
29 import java.io.InputStream JavaDoc;
30 import java.io.OutputStream JavaDoc;
31
32 public
33 class RecordImpl implements Record, Serializable JavaDoc, Streamable {
34   
35   String JavaDoc name;
36   String JavaDoc desc;
37   
38   public RecordImpl() {
39   }
40
41   // Get the name
42
public
43   String JavaDoc getRecordName() {
44     return name;
45   }
46   
47   // Set the name
48
public
49   void setRecordName(String JavaDoc name) {
50     this.name = name;
51   }
52   
53   // Set a short description string for this Record
54
public
55   void setRecordShortDescription(String JavaDoc description) {
56     this.desc = description;
57   }
58
59
60   // Get a short description string for this Record
61
public
62   String JavaDoc getRecordShortDescription() {
63     return desc;
64   }
65
66
67   // Check if this instance is equal to another Record
68
public
69   boolean equals(Object JavaDoc other) {
70     // ...
71
return true;
72   }
73
74   // Read data from an InputStream and initialize fields
75
public
76   void read(InputStream JavaDoc istream) throws IOException JavaDoc {
77     //....
78
}
79   
80
81   // Write fields of a Streamable object to an OutputStream
82
public
83   void write(OutputStream JavaDoc ostream) throws IOException JavaDoc {
84     //...
85
}
86
87   public Object JavaDoc clone() throws CloneNotSupportedException JavaDoc {
88     return this;
89   }
90 }
91
Popular Tags