Update of /cvsroot/commonjava/commonjava-projects/commonjava-lang/src/java/org/commonjava/lang
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29313/src/java/org/commonjava/lang
Modified Files:
LongID.java IntegerID.java StringID.java
Log Message:
umm...forgot that these other ID classes are abstract, and will need to have an implementation of the read/writeObject stuff, since the concrete implementations won't have access to the internal representation of the IDs.
Index: LongID.java
===================================================================
RCS file: /cvsroot/commonjava/commonjava-projects/commonjava-lang/src/java/org/commonjava/lang/LongID.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- LongID.java 18 Sep 2003 01:10:42 -0000 1.1
+++ LongID.java 2 Feb 2004 02:32:47 -0000 1.2
@@ -11,6 +11,9 @@
package org.commonjava.lang;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
import java.io.Serializable;
/** Identifier abstract implementation that encapsulates a long for the
@@ -68,4 +71,19 @@
public long getID(){
return ID.longValue();
}
+
+ /* (non-Javadoc)
+ * @see org.commonjava.lang.AbstractID#readObject(java.io.ObjectInputStream)
+ */
+ protected void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ this.ID = (Long)in.readObject();
+ }
+
+ /* (non-Javadoc)
+ * @see org.commonjava.lang.AbstractID#writeObject(java.io.ObjectOutputStream)
+ */
+ protected void writeObject(ObjectOutputStream out) throws IOException {
+ out.writeObject(ID);
+ }
+
}
\ No newline at end of file
Index: IntegerID.java
===================================================================
RCS file: /cvsroot/commonjava/commonjava-projects/commonjava-lang/src/java/org/commonjava/lang/IntegerID.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- IntegerID.java 18 Sep 2003 01:10:42 -0000 1.1
+++ IntegerID.java 2 Feb 2004 02:32:47 -0000 1.2
@@ -11,6 +11,9 @@
package org.commonjava.lang;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
import java.io.Serializable;
/** Representation of an identifier (like a primary key or something) that uses
@@ -76,4 +79,18 @@
this.ID = id;
}
+ /* (non-Javadoc)
+ * @see org.commonjava.lang.AbstractID#readObject(java.io.ObjectInputStream)
+ */
+ protected void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ this.ID = (Integer)in.readObject();
+ }
+
+ /* (non-Javadoc)
+ * @see org.commonjava.lang.AbstractID#writeObject(java.io.ObjectOutputStream)
+ */
+ protected void writeObject(ObjectOutputStream out) throws IOException {
+ out.writeObject(ID);
+ }
+
}
\ No newline at end of file
Index: StringID.java
===================================================================
RCS file: /cvsroot/commonjava/commonjava-projects/commonjava-lang/src/java/org/commonjava/lang/StringID.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- StringID.java 18 Sep 2003 01:10:42 -0000 1.1
+++ StringID.java 2 Feb 2004 02:32:47 -0000 1.2
@@ -11,6 +11,9 @@
package org.commonjava.lang;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
import java.io.Serializable;
public abstract class StringID extends AbstractID implements Serializable, Comparable
@@ -64,4 +67,19 @@
public String getID(){
return ID;
}
+
+ /* (non-Javadoc)
+ * @see org.commonjava.lang.AbstractID#readObject(java.io.ObjectInputStream)
+ */
+ protected void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ this.ID = (String)in.readObject();
+ }
+
+ /* (non-Javadoc)
+ * @see org.commonjava.lang.AbstractID#writeObject(java.io.ObjectOutputStream)
+ */
+ protected void writeObject(ObjectOutputStream out) throws IOException {
+ out.writeObject(ID);
+ }
+
}
\ No newline at end of file
|