Java: Reflection Packet Builder using getField()
- by Matchlighter
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?