scolebourne 2004/04/07 16:05:37
Modified: collections/src/java/org/apache/commons/collections/map
LazySortedMap.java LazyMap.java
collections RELEASE-NOTES.html
collections/src/test/org/apache/commons/collections/map
TestLazyMap.java TestLazySortedMap.java
Added: collections/data/test LazyMap.emptyCollection.version3.1.obj
LazyMap.fullCollection.version3.1.obj
LazySortedMap.fullCollection.version3.1.obj
LazySortedMap.emptyCollection.version3.1.obj
Log:
Make LazyMap/LazySortedMap Serializable [18815]
Revision Changes Path
1.5 +28 -2
jakarta-commons/collections/src/java/org/apache/commons/collections/map/LazySortedMap.java
Index: LazySortedMap.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/map/LazySortedMap.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- LazySortedMap.java 18 Feb 2004 01:13:19 -0000 1.4
+++ LazySortedMap.java 7 Apr 2004 23:05:37 -0000 1.5
@@ -15,7 +15,12 @@
*/
package org.apache.commons.collections.map;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
import java.util.Comparator;
+import java.util.Map;
import java.util.SortedMap;
import org.apache.commons.collections.Factory;
@@ -50,7 +55,11 @@
* @author Paul Jack
*/
public class LazySortedMap
- extends LazyMap implements SortedMap {
+ extends LazyMap
+ implements SortedMap, Serializable {
+
+ /** Serialization version */
+ private static final long serialVersionUID = 2715322183617658933L;
/**
* Factory method to create a lazily instantiated sorted map.
@@ -95,6 +104,23 @@
*/
protected LazySortedMap(SortedMap map, Transformer factory) {
super(map, factory);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Write the map out using a custom routine.
+ */
+ private void writeObject(ObjectOutputStream out) throws IOException {
+ out.defaultWriteObject();
+ out.writeObject(map);
+ }
+
+ /**
+ * Read the map in using a custom routine.
+ */
+ private void readObject(ObjectInputStream in) throws IOException,
ClassNotFoundException {
+ in.defaultReadObject();
+ map = (Map) in.readObject();
}
/**
1.5 +27 -2
jakarta-commons/collections/src/java/org/apache/commons/collections/map/LazyMap.java
Index: LazyMap.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/map/LazyMap.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- LazyMap.java 18 Feb 2004 01:13:19 -0000 1.4
+++ LazyMap.java 7 Apr 2004 23:05:37 -0000 1.5
@@ -15,6 +15,10 @@
*/
package org.apache.commons.collections.map;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
import java.util.Map;
import org.apache.commons.collections.Factory;
@@ -50,7 +54,11 @@
* @author Paul Jack
*/
public class LazyMap
- extends AbstractMapDecorator implements Map {
+ extends AbstractMapDecorator
+ implements Map, Serializable {
+
+ /** Serialization version */
+ private static final long serialVersionUID = 7990956402564206740L;
/** The factory to use to construct elements */
protected final Transformer factory;
@@ -106,6 +114,23 @@
throw new IllegalArgumentException("Factory must not be null");
}
this.factory = factory;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Write the map out using a custom routine.
+ */
+ private void writeObject(ObjectOutputStream out) throws IOException {
+ out.defaultWriteObject();
+ out.writeObject(map);
+ }
+
+ /**
+ * Read the map in using a custom routine.
+ */
+ private void readObject(ObjectInputStream in) throws IOException,
ClassNotFoundException {
+ in.defaultReadObject();
+ map = (Map) in.readObject();
}
//-----------------------------------------------------------------------
1.27 +2 -0 jakarta-commons/collections/RELEASE-NOTES.html
Index: RELEASE-NOTES.html
===================================================================
RCS file: /home/cvs/jakarta-commons/collections/RELEASE-NOTES.html,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- RELEASE-NOTES.html 2 Apr 2004 23:12:34 -0000 1.26
+++ RELEASE-NOTES.html 7 Apr 2004 23:05:37 -0000 1.27
@@ -35,6 +35,8 @@
<li>Fast3Map - Add clone() method</li>
<li>FixedSizeMap - Make Serializable [18815]</li>
<li>FixedSizeSortedMap - Make Serializable [18815]</li>
+<li>LazyMap - Make Serializable [18815]</li>
+<li>LazySortedMap - Make Serializable [18815]</li>
<li>MultiKey - Add getKey(index) and size() methods and make constructor public</li>
<li>MultiHashMap - Add five methods to improve the API</li>
<li>AbstractHashedMap,AbstractLinkedMap - Add methods to access entry methods when
protected scope blocks</li>
1.6 +17 -2
jakarta-commons/collections/src/test/org/apache/commons/collections/map/TestLazyMap.java
Index: TestLazyMap.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/map/TestLazyMap.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- TestLazyMap.java 18 Feb 2004 01:20:38 -0000 1.5
+++ TestLazyMap.java 7 Apr 2004 23:05:37 -0000 1.6
@@ -83,5 +83,20 @@
assertEquals(null,o);
assertEquals(1, map.size());
- }
+ }
+
+ public String getCompatibilityVersion() {
+ return "3.1";
+ }
+
+// public void testCreate() throws Exception {
+// resetEmpty();
+// writeExternalFormToDisk(
+// (java.io.Serializable) map,
+//
"D:/dev/collections/data/test/LazyMap.emptyCollection.version3.1.obj");
+// resetFull();
+// writeExternalFormToDisk(
+// (java.io.Serializable) map,
+// "D:/dev/collections/data/test/LazyMap.fullCollection.version3.1.obj");
+// }
}
1.5 +16 -1
jakarta-commons/collections/src/test/org/apache/commons/collections/map/TestLazySortedMap.java
Index: TestLazySortedMap.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/map/TestLazySortedMap.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- TestLazySortedMap.java 18 Feb 2004 01:20:38 -0000 1.4
+++ TestLazySortedMap.java 7 Apr 2004 23:05:37 -0000 1.5
@@ -107,4 +107,19 @@
// expected
}
}
+
+ public String getCompatibilityVersion() {
+ return "3.1";
+ }
+
+// public void testCreate() throws Exception {
+// resetEmpty();
+// writeExternalFormToDisk(
+// (java.io.Serializable) map,
+//
"D:/dev/collections/data/test/LazySortedMap.emptyCollection.version3.1.obj");
+// resetFull();
+// writeExternalFormToDisk(
+// (java.io.Serializable) map,
+//
"D:/dev/collections/data/test/LazySortedMap.fullCollection.version3.1.obj");
+// }
}
1.1
jakarta-commons/collections/data/test/LazyMap.emptyCollection.version3.1.obj
<<Binary file>>
1.1
jakarta-commons/collections/data/test/LazyMap.fullCollection.version3.1.obj
<<Binary file>>
1.1
jakarta-commons/collections/data/test/LazySortedMap.fullCollection.version3.1.obj
<<Binary file>>
1.1
jakarta-commons/collections/data/test/LazySortedMap.emptyCollection.version3.1.obj
<<Binary file>>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]