Re-revamp. I may re-re-revamp later to eliminate the reflection based streaming

altogether as that also solves the "Class.getDeclaredFields() is not required
to return fields in declaration order" problem which has been looming. However,
this should work for now.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4701 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2007-05-09 00:20:35 +00:00
parent 0cba1203c9
commit ef43b9d41a
5 changed files with 548 additions and 484 deletions
+13 -13
View File
@@ -245,7 +245,7 @@ public class Streamer
* array must be read before creating the array).
*/
public Object createObject (ObjectInputStream in)
throws IOException
throws IOException, ClassNotFoundException
{
try {
// if our target class is an array type, read in the element count and create an array
@@ -435,6 +435,18 @@ public class Streamer
return;
}
// look up the reader and writer methods
try {
_reader = target.getMethod(READER_METHOD_NAME, READER_ARGS);
} catch (NoSuchMethodException nsme) {
// nothing to worry about, we just don't have one
}
try {
_writer = target.getMethod(WRITER_METHOD_NAME, WRITER_ARGS);
} catch (NoSuchMethodException nsme) {
// nothing to worry about, we just don't have one
}
// reflect on all the object's fields
_fields = ClassUtil.getFields(target);
int fcount = _fields.length;
@@ -448,18 +460,6 @@ public class Streamer
_fields[ii].getName() + ".");
}
}
// look up the reader and writer methods
try {
_reader = target.getMethod(READER_METHOD_NAME, READER_ARGS);
} catch (NoSuchMethodException nsme) {
// nothing to worry about, we just don't have one
}
try {
_writer = target.getMethod(WRITER_METHOD_NAME, WRITER_ARGS);
} catch (NoSuchMethodException nsme) {
// nothing to worry about, we just don't have one
}
}
/**