The INSTANCE constant only really makes sense for ListStreamer,

as it's used for Collections, too.

Nixed my commented-out EnumSet/EnumMap explorations. A dead end.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6518 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2011-03-07 19:58:48 +00:00
parent 568765dd13
commit 3640b7c289
@@ -68,10 +68,10 @@ public class BasicStreamers
.put(Object[].class, new ObjectArrayStreamer()) .put(Object[].class, new ObjectArrayStreamer())
.put(List.class, ListStreamer.INSTANCE) .put(List.class, ListStreamer.INSTANCE)
.put(Collection.class, ListStreamer.INSTANCE) .put(Collection.class, ListStreamer.INSTANCE)
.put(Set.class, SetStreamer.INSTANCE) .put(Set.class, new SetStreamer())
.put(Map.class, MapStreamer.INSTANCE) .put(Map.class, new MapStreamer())
.put(Multiset.class, MultisetStreamer.INSTANCE) .put(Multiset.class, new MultisetStreamer())
.put(Iterable.class, IterableStreamer.INSTANCE) .put(Iterable.class, new IterableStreamer())
.build(); .build();
/** Streams {@link Boolean} instances. */ /** Streams {@link Boolean} instances. */
@@ -480,9 +480,6 @@ public class BasicStreamers
/** Streams {@link Set} instances. */ /** Streams {@link Set} instances. */
public static class SetStreamer extends CollectionStreamer public static class SetStreamer extends CollectionStreamer
{ {
/** A singleton instance. */
public static final SetStreamer INSTANCE = new SetStreamer();
@Override @Override
protected Collection<Object> createCollection (int size) protected Collection<Object> createCollection (int size)
{ {
@@ -506,9 +503,6 @@ public class BasicStreamers
/** Copy a non-Collection {@link Iterable} into a List. */ /** Copy a non-Collection {@link Iterable} into a List. */
public static class IterableStreamer extends ListStreamer public static class IterableStreamer extends ListStreamer
{ {
/** A singleton instance. */
public static final IterableStreamer INSTANCE = new IterableStreamer();
@Override @Override
public void writeObject (Object object, ObjectOutputStream out, boolean useWriter) public void writeObject (Object object, ObjectOutputStream out, boolean useWriter)
throws IOException throws IOException
@@ -521,9 +515,6 @@ public class BasicStreamers
/** Streams {@link Map} instances. */ /** Streams {@link Map} instances. */
public static class MapStreamer extends BasicStreamer public static class MapStreamer extends BasicStreamer
{ {
/** A singleton instance. */
public static final MapStreamer INSTANCE = new MapStreamer();
@Override @Override
public Object createObject (ObjectInputStream in) public Object createObject (ObjectInputStream in)
throws IOException, ClassNotFoundException throws IOException, ClassNotFoundException
@@ -560,9 +551,6 @@ public class BasicStreamers
/** Streams {@link Multiset} instances. */ /** Streams {@link Multiset} instances. */
public static class MultisetStreamer extends BasicStreamer public static class MultisetStreamer extends BasicStreamer
{ {
/** A singleton instance. */
public static final MultisetStreamer INSTANCE = new MultisetStreamer();
@Override @Override
public Object createObject (ObjectInputStream in) public Object createObject (ObjectInputStream in)
throws IOException, ClassNotFoundException throws IOException, ClassNotFoundException
@@ -600,15 +588,6 @@ public class BasicStreamers
} }
} }
// // TODO : We can't create an EnumMap of zero size- we need to know the key class
// public static class EnumMapStreamer extends MapStreamer
// {
// }
// // TODO : We can't create an EnumSet of zero size- we need to know the key class
// public static class EnumSetStreamer extends CollectionStreamer
// {
// }
/** Streams {@link String} instances. */ /** Streams {@link String} instances. */
public static class BasicStreamer extends Streamer public static class BasicStreamer extends Streamer
{ {