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(List.class, ListStreamer.INSTANCE)
.put(Collection.class, ListStreamer.INSTANCE)
.put(Set.class, SetStreamer.INSTANCE)
.put(Map.class, MapStreamer.INSTANCE)
.put(Multiset.class, MultisetStreamer.INSTANCE)
.put(Iterable.class, IterableStreamer.INSTANCE)
.put(Set.class, new SetStreamer())
.put(Map.class, new MapStreamer())
.put(Multiset.class, new MultisetStreamer())
.put(Iterable.class, new IterableStreamer())
.build();
/** Streams {@link Boolean} instances. */
@@ -480,9 +480,6 @@ public class BasicStreamers
/** Streams {@link Set} instances. */
public static class SetStreamer extends CollectionStreamer
{
/** A singleton instance. */
public static final SetStreamer INSTANCE = new SetStreamer();
@Override
protected Collection<Object> createCollection (int size)
{
@@ -506,9 +503,6 @@ public class BasicStreamers
/** Copy a non-Collection {@link Iterable} into a List. */
public static class IterableStreamer extends ListStreamer
{
/** A singleton instance. */
public static final IterableStreamer INSTANCE = new IterableStreamer();
@Override
public void writeObject (Object object, ObjectOutputStream out, boolean useWriter)
throws IOException
@@ -521,9 +515,6 @@ public class BasicStreamers
/** Streams {@link Map} instances. */
public static class MapStreamer extends BasicStreamer
{
/** A singleton instance. */
public static final MapStreamer INSTANCE = new MapStreamer();
@Override
public Object createObject (ObjectInputStream in)
throws IOException, ClassNotFoundException
@@ -560,9 +551,6 @@ public class BasicStreamers
/** Streams {@link Multiset} instances. */
public static class MultisetStreamer extends BasicStreamer
{
/** A singleton instance. */
public static final MultisetStreamer INSTANCE = new MultisetStreamer();
@Override
public Object createObject (ObjectInputStream in)
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. */
public static class BasicStreamer extends Streamer
{