🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.api
Article #144

Re: Printing the Values of Class properties

#144
From: Gillmer J. Derge (TeamB)
Date: Mon, 24 May 2004 12:30
13 lines
1572 bytes
L Remond wrote:
> I have a class with about 30 properties and I would like to print the value of them all without using a System.out.println for each one.  I am using the following code to extract the properties from the class but I do not see any methods that wil allow me to print the values of them
> 
>     Field[] fields = this.getClass().getDeclaredFields();
>      for ( int i=0; i < fields.length; i++ )
>      {
>         System.out.println(fields[i].getName() + " : values: "  );

System.out.println(fields[i].getName() + " : values: " + 
fields[i].get(this));

-- 
Gillmer J. Derge (TeamB)
Technical Details
Message-ID: <40b1eb00@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!controlnews3.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <40b1e6ec$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1089d0,de5620ad508d2ac9
X-Google-Attributes: gid1089d0,public
Date: Mon, 24 May 2004 08:30:58 -0400
From: "Gillmer J. Derge (TeamB)" <spam@gillmerderge.com>
User-Agent: Mozilla Thunderbird 0.5 (Windows/20040207)
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.jbuilder.java.api
Subject: Re: Printing the Values of Class properties
References: <40b1e6ec$1@newsgroups.borland.com>
In-Reply-To: <40b1e6ec$1@newsgroups.borland.com>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 64.185.133.6
Message-ID: <40b1eb00@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1085401856 64.185.133.6 (24 May 2004 05:30:56 -0700)
Lines: 13
Path: arc1-ca.pugleaf.net!controlnews3.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail