KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jacorb > test > orb > rmi > Zoo


1 package org.jacorb.test.orb.rmi;
2
3 public class Zoo implements java.io.Serializable JavaDoc {
4     public String JavaDoc id;
5     public String JavaDoc name;
6     public Zoo inner;
7     private transient Object JavaDoc hidden = "hidden";
8     public Zoo(String JavaDoc id, String JavaDoc name) {
9         this.id = id;
10         this.name = name;
11     this.inner = null;
12     }
13     public Zoo(String JavaDoc id, String JavaDoc name, Zoo inner) {
14         this.id = id;
15         this.name = name;
16     this.inner = inner;
17     }
18     public String JavaDoc toString() {
19         return "Zoo(" + id + ", \"" + name + "\"" +
20         ((inner == null) ? "" : ", " + inner.toString()) + ")";
21     }
22     public boolean equals(Object JavaDoc o) {
23     return (o instanceof Zoo)
24         && (((Zoo)o).id.equals(id))
25         && (((Zoo)o).name.equals(name))
26         && ((((Zoo)o).inner == null && inner == null)
27         || (((Zoo)o).inner != null && ((Zoo)o).inner.equals(inner)));
28     }
29     private synchronized void writeObject(java.io.ObjectOutputStream JavaDoc s)
30         throws java.io.IOException JavaDoc {
31     id = id + "!";
32         s.defaultWriteObject();
33     }
34 }
35
Popular Tags