Java: Reflection Packet Builder using getField()

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 5:20 UTC
Read the original article Hit count: 254

Filed under:
|
|

So I just finished writing a packet builder that dynamically loads data into a data stream which is then sent out. Each builder operates by finding fields in its class (and its superclasses) that are marked with an @data annotation. Upon finishing the builder, I remembered that getFields() does not return in "any specific order".

I quite like my builder because it allows for quite simple, yet hard-typed packets.

Could this implementation be a problem? What would be the best next step to keep the simplicity - do alphabetical sorting of fields?

© Game Development or respective owner

Related posts about java

Related posts about reflection