KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > AutoImpl


1 // $Id: AutoImpl.java,v 1.2 2002/09/02 09:00:32 per_nyfelt Exp $
2

3 import org.ozoneDB.*;
4
5
6 public class AutoImpl extends OzoneObject implements Auto {
7     
8     /**
9      * The serialization version id used by the Java serialization.
10      * Please, see also the Java documentation.
11      */

12     final static long serialVersionUID = 1L;
13     
14     String JavaDoc name = "Ford";
15     
16     int age = 0;
17     
18     Auto link;
19     
20     
21     public AutoImpl() {
22         System.out.println( getClass().getName() + " ctor..." );
23     }
24     
25     
26     public boolean equals( Object JavaDoc obj ) {
27         Auto auto = (Auto)obj;
28         return name.equals( auto.name() );
29     }
30     
31     
32     public Auto doSomething( Auto auto ) throws Exception JavaDoc {
33         System.out.println( "got: " + auto.toString() + " (" + auto.getClass().getName() + ")" );
34         return this;
35     }
36     
37     
38     public Auto setLink( Auto auto ) throws Exception JavaDoc {
39         // System.out.println ("setLink(): " + auto.toString() + " (" + auto.getClass().getName() + ")");
40
link = auto;
41         return this;
42     }
43     
44     
45     public void print() {
46         System.out.println( toString() );
47     }
48     
49     
50     public void setName( String JavaDoc newName ) {
51         name = newName;
52     }
53     
54     
55     public String JavaDoc name() {
56         return name;
57     }
58     
59     
60     public void setAge( Integer JavaDoc newAge ) {
61         age = newAge.intValue();
62     // throw new NullPointerException();
63
}
64     
65     
66     public int setAge( int newAge ) {
67         int result = age;
68         age = newAge;
69         return result;
70     }
71     
72     
73     public Integer JavaDoc age() {
74         return new Integer JavaDoc( age );
75     }
76     
77     
78     public String JavaDoc toString() {
79         // System.out.println ("toString()...");
80
return "Auto:" + name + ", " + String.valueOf( age );
81     }
82     
83     
84     public void done() throws Exception JavaDoc {
85     // System.out.println (toString() + " done.");
86
}
87     
88 }
89
Popular Tags