tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Kerber <dcker...@verizon.net>
Subject Re: How to get fields list in order
Date Thu, 02 Nov 2006 14:23:30 GMT
Christopher Schultz wrote:

>David,
>
>  
>
>>How can I get a list of the public fields declared in a class, *in the
>>order they are declared*?  Using Reflection's getFields and
>>getDeclaredFields methods returns them in no particular order, and I
>>need them in the order they are declared so I can get their starting
>>byte offsets.
>>    
>>
>
>Since you mentioned byte offsets, I have to ask: are you trying to
>subvert the serialization system? Or, even worse, inspect the object
>memory from with JNI?
>  
>
The latter, sort of.  I'm using a package which puts a wrapper around 
JNI to make it easier to create windows standard .dll's from java 
classes, and passing them structures from Visual Basic and other 
external apps.  To modify return parameters, I need the byte offsets of 
the various pieces of the structure, which I'm mirroring in my java classes.

>I would guess that if you can't get the proper order of the fields from
>Class.getDeclaredFields, then you can't get it at all.
>  
>
That's what I'm afraid of.  I know how I can work around this, but it's 
a lot more typing when setting up the class fields.

Thanks for the response!



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message