Return-Path: Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: (qmail 94641 invoked from network); 2 Nov 2006 14:24:33 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 2 Nov 2006 14:24:33 -0000 Received: (qmail 76084 invoked by uid 500); 2 Nov 2006 14:24:27 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 76054 invoked by uid 500); 2 Nov 2006 14:24:27 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 76043 invoked by uid 99); 2 Nov 2006 14:24:27 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 Nov 2006 06:24:27 -0800 X-ASF-Spam-Status: No, hits=3.3 required=10.0 tests=DNS_FROM_RFC_ABUSE,DNS_FROM_RFC_POST,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (herse.apache.org: 204.17.65.6 is neither permitted nor denied by domain of dckerber@verizon.net) Received: from [204.17.65.6] (HELO mr02.conversent.net) (204.17.65.6) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 Nov 2006 06:24:05 -0800 Received: from [127.0.0.1] (host254.111.41.216.conversent.net [216.41.111.254]) (authenticated bits=0) by mr02.conversent.net (8.13.4/8.13.4) with ESMTP id kA2ENZRb016539 for ; Thu, 2 Nov 2006 09:23:40 -0500 (EST) Message-ID: <4549FF62.4020704@verizon.net> Date: Thu, 02 Nov 2006 09:23:30 -0500 From: David Kerber User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tomcat Users List Subject: Re: How to get fields list in order References: <4549F3E9.6010804@verizon.net> <4549FC1D.8030708@christopherschultz.net> In-Reply-To: <4549FC1D.8030708@christopherschultz.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org 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