diff --git a/RELEASE-NOTES.html b/RELEASE-NOTES.html index 55e085988..24b4db57a 100644 --- a/RELEASE-NOTES.html +++ b/RELEASE-NOTES.html @@ -33,6 +33,7 @@ No interface changes, or deprecations have occurred.
  • ReferenceMap - Changed to extend AbstractHashedMap, thus gaining a mapIterator() and subclassability
  • Fast3Map - Make Serializable [27946]
  • Fast3Map - Add clone() method
  • +
  • FixedSizeMap - Make Serializable [18815]
  • MultiKey - Add getKey(index) and size() methods and make constructor public
  • MultiHashMap - Add five methods to improve the API
  • AbstractHashedMap,AbstractLinkedMap - Add methods to access entry methods when protected scope blocks
  • diff --git a/data/test/FixedSizeMap.emptyCollection.version3.1.obj b/data/test/FixedSizeMap.emptyCollection.version3.1.obj new file mode 100644 index 000000000..a22abc377 Binary files /dev/null and b/data/test/FixedSizeMap.emptyCollection.version3.1.obj differ diff --git a/data/test/FixedSizeMap.fullCollection.version3.1.obj b/data/test/FixedSizeMap.fullCollection.version3.1.obj new file mode 100644 index 000000000..2ab7b8572 Binary files /dev/null and b/data/test/FixedSizeMap.fullCollection.version3.1.obj differ diff --git a/src/java/org/apache/commons/collections/map/FixedSizeMap.java b/src/java/org/apache/commons/collections/map/FixedSizeMap.java index d2fde29d3..64831648a 100644 --- a/src/java/org/apache/commons/collections/map/FixedSizeMap.java +++ b/src/java/org/apache/commons/collections/map/FixedSizeMap.java @@ -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.Collection; import java.util.Iterator; import java.util.Map; @@ -38,13 +42,17 @@ import org.apache.commons.collections.set.UnmodifiableSet; * is not always unsupported. * * @since Commons Collections 3.0 - * @version $Revision: 1.5 $ $Date: 2004/02/18 01:13:19 $ + * @version $Revision: 1.6 $ $Date: 2004/04/02 21:15:05 $ * * @author Stephen Colebourne * @author Paul Jack */ public class FixedSizeMap - extends AbstractMapDecorator implements Map, BoundedMap { + extends AbstractMapDecorator + implements Map, BoundedMap, Serializable { + + /** Serialization version */ + private static final long serialVersionUID = 7450927208116179316L; /** * Factory method to create a fixed size map. @@ -66,7 +74,24 @@ public class FixedSizeMap protected FixedSizeMap(Map map) { super(map); } - + + //----------------------------------------------------------------------- + /** + * 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(); + } + //----------------------------------------------------------------------- public Object put(Object key, Object value) { if (map.containsKey(key) == false) { diff --git a/src/test/org/apache/commons/collections/map/TestFixedSizeMap.java b/src/test/org/apache/commons/collections/map/TestFixedSizeMap.java index 3af2e59cb..982af6253 100644 --- a/src/test/org/apache/commons/collections/map/TestFixedSizeMap.java +++ b/src/test/org/apache/commons/collections/map/TestFixedSizeMap.java @@ -26,7 +26,7 @@ import junit.framework.TestSuite; * implementation. * * @since Commons Collections 3.0 - * @version $Revision: 1.5 $ $Date: 2004/02/18 01:20:38 $ + * @version $Revision: 1.6 $ $Date: 2004/04/02 21:15:05 $ * * @author Stephen Colebourne */ @@ -63,4 +63,18 @@ public class TestFixedSizeMap extends AbstractTestMap { return false; } + public String getCompatibilityVersion() { + return "3.1"; + } + +// public void testCreate() throws Exception { +// resetEmpty(); +// writeExternalFormToDisk( +// (java.io.Serializable) map, +// "D:/dev/collections/data/test/FixedSizeMap.emptyCollection.version3.1.obj"); +// resetFull(); +// writeExternalFormToDisk( +// (java.io.Serializable) map, +// "D:/dev/collections/data/test/FixedSizeMap.fullCollection.version3.1.obj"); +// } }