Is it important for reflection-based serialization maintain consistent field ordering?

Posted by Matchlighter on Game Development See other posts from Game Development or by Matchlighter
Published on 2013-07-03T04:27:06Z Indexed on 2013/07/03 11:20 UTC
Read the original article Hit count: 375

Filed under:
|
|

I just finished writing a packet builder that dynamically loads data into a data stream for eventual network transmission. Each builder operates by finding fields in a given class (and its superclasses) that are marked with a @data annotation.

When I finishing my implementation, I remembered that getFields() does not return results in any specific order.

Should reflection-based methods for serializing arbitrary data (like my packets) attempt to preserve a specific field ordering (such as alphabetical), and if so, how?

© Game Development or respective owner

Related posts about java

Related posts about reflection