I need to traverse through the bytearray and create an object for it. I have collection of objects/classes with member variables and their set and get methods.The fields in the objects correspond to one or multiple bytes in the byte array.Is there an elegant way to convert this byte array into object? Walking through the byte array seems a basic thought but ugly. Particularily when the byte array changes the code will have to change. The first byte in the bytearray indicates object identifier. Does Java reflection promises solution here? However I have heard reflection is slow and I might not tend to use it.
Joined: Jan 29, 2003
How is the byte array created? Do you have any other choices, like serialize?
How is the byte array structured? Maybe an example ... what would it look like for an object about you:
From the looks of things right now reflection may be the answer. Don't worry about the speed until you try it and prove it's too slow. I'm told it has gotten better in every JDK release.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi