More type safety.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4244 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2006-07-05 00:51:22 +00:00
parent a89473d1b5
commit 94b79826d4
9 changed files with 59 additions and 54 deletions
@@ -62,12 +62,12 @@ public abstract class FieldMarshaller
}
// if we have an exact match, use that
FieldMarshaller fm = (FieldMarshaller)_marshallers.get(ftype);
FieldMarshaller fm = _marshallers.get(ftype);
// otherwise if the class is a streamable, use the streamable
// marshaller
if (fm == null && Streamer.isStreamable(ftype)) {
fm = (FieldMarshaller)_marshallers.get(Streamable.class);
fm = _marshallers.get(Streamable.class);
}
return fm;
@@ -124,7 +124,7 @@ public abstract class FieldMarshaller
protected static void createMarshallers ()
{
// create our table
_marshallers = new HashMap();
_marshallers = new HashMap<Class,FieldMarshaller>();
// create a generic marshaller for streamable instances
FieldMarshaller gmarsh = new FieldMarshaller() {
@@ -270,5 +270,5 @@ public abstract class FieldMarshaller
/** Contains a mapping from field type to field marshaller instance
* for that type. */
protected static HashMap _marshallers;
protected static HashMap<Class,FieldMarshaller> _marshallers;
}
@@ -66,7 +66,7 @@ public class ObjectInputStream extends DataInputStream
public void addTranslation (String oldname, String newname)
{
if (_translations == null) {
_translations = new HashMap();
_translations = new HashMap<String,String>();
}
_translations.put(oldname, newname);
}
@@ -82,7 +82,7 @@ public class ObjectInputStream extends DataInputStream
// create our classmap if necessary
if (_classmap == null) {
_classmap = new HashIntMap();
_classmap = new HashIntMap<ClassMapping>();
}
try {
@@ -107,7 +107,7 @@ public class ObjectInputStream extends DataInputStream
// if we have a translation (used to cope when serialized
// classes are renamed) use it
if (_translations != null) {
String tname = (String)_translations.get(cname);
String tname = _translations.get(cname);
if (tname != null) {
cname = tname;
}
@@ -132,7 +132,7 @@ public class ObjectInputStream extends DataInputStream
_classmap.put(code, cmap);
} else {
cmap = (ClassMapping)_classmap.get(code);
cmap = _classmap.get(code);
// sanity check
if (cmap == null) {
@@ -224,7 +224,7 @@ public class ObjectInputStream extends DataInputStream
/** Used to map classes to numeric codes and the {@link Streamer}
* instance used to write them. */
protected HashIntMap _classmap;
protected HashIntMap<ClassMapping> _classmap;
/** The object currently being read from the stream. */
protected Object _current;
@@ -237,7 +237,7 @@ public class ObjectInputStream extends DataInputStream
/** An optional set of class name translations to use when
* unserializing objects. */
protected HashMap _translations;
protected HashMap<String,String> _translations;
/** Used to activate verbose debug logging. */
protected static final boolean STREAM_DEBUG = false;
@@ -70,7 +70,7 @@ public class ObjectOutputStream extends DataOutputStream
public void addTranslation (String className, String streamedName)
{
if (_translations == null) {
_translations = new HashMap();
_translations = new HashMap<String,String>();
}
_translations.put(className, streamedName);
}
@@ -90,12 +90,12 @@ public class ObjectOutputStream extends DataOutputStream
// create our classmap if necessary
if (_classmap == null) {
_classmap = new HashMap();
_classmap = new HashMap<Class,ClassMapping>();
}
// otherwise, look up the class mapping record
Class sclass = object.getClass();
ClassMapping cmap = (ClassMapping)_classmap.get(sclass);
ClassMapping cmap = _classmap.get(sclass);
// create a class mapping for this class if we've not got one
if (cmap == null) {
@@ -119,7 +119,7 @@ public class ObjectOutputStream extends DataOutputStream
writeShort(-cmap.code);
String cname = sclass.getName();
if (_translations != null) {
String tname = (String) _translations.get(cname);
String tname = _translations.get(cname);
if (tname != null) {
cname = tname;
}
@@ -191,7 +191,7 @@ public class ObjectOutputStream extends DataOutputStream
/** Used to map classes to numeric codes and the {@link Streamer}
* instance used to write them. */
protected HashMap _classmap;
protected HashMap<Class,ClassMapping> _classmap;
/** A counter used to assign codes to streamed classes. */
protected short _nextCode = 1;
@@ -204,5 +204,5 @@ public class ObjectOutputStream extends DataOutputStream
/** An optional set of class name translations to use when serializing
* objects. */
protected HashMap _translations;
protected HashMap<String,String> _translations;
}