Return-Path: Delivered-To: apmail-jakarta-commons-user-archive@www.apache.org Received: (qmail 92781 invoked from network); 1 Dec 2003 19:24:30 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 1 Dec 2003 19:24:30 -0000 Received: (qmail 67765 invoked by uid 500); 1 Dec 2003 19:24:19 -0000 Delivered-To: apmail-jakarta-commons-user-archive@jakarta.apache.org Received: (qmail 67370 invoked by uid 500); 1 Dec 2003 19:24:16 -0000 Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Users List" Reply-To: "Jakarta Commons Users List" Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 67357 invoked from network); 1 Dec 2003 19:24:16 -0000 Received: from unknown (HELO swan.mail.pas.earthlink.net) (207.217.120.123) by daedalus.apache.org with SMTP; 1 Dec 2003 19:24:16 -0000 Received: from h-66-167-117-200.sndacagl.dynamic.covad.net ([66.167.117.200] helo=localhost.localdomain) by swan.mail.pas.earthlink.net with esmtp (Exim 3.33 #1) id 1AQteb-0002v6-00 for commons-user@jakarta.apache.org; Mon, 01 Dec 2003 11:24:17 -0800 Received: from phreaker.net (sd.fgm.com [207.158.2.130]) (authenticated) by localhost.localdomain (8.11.6/8.11.6) with ESMTP id hB1JMef05260 for ; Mon, 1 Dec 2003 11:22:40 -0800 Message-ID: <3FCB9559.8080104@phreaker.net> Date: Mon, 01 Dec 2003 11:24:09 -0800 From: __matthewHawthorne User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031014 Thunderbird/0.3 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Jakarta Commons Users List Subject: Re: BasicDynaBean and overriding the toString() References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N It sounds like you need to define some type of display wrapper. You could create a static method to do this: static final String display(BasicDynaBean bean, String prop) { return return bean.get(prop); } Or create a hierarchy -- if you're into this sort of thing... public abstract BasicDynaBeanView BasicDynaBeanView(BasicDynaBean bean) { abstract String display() {} } So, if I'm understanding you correctly, there are tons of ways to solve your problem. You need to create a layer in between your GUI and the DynaBeans which contain the data. dumdum 420 wrote: > Hi All, > > I am using the BasicDynaBean for my entire project which seemed to be > working fine till I started coding for the frontend which is java swing > based. > > Since the BasicDynaBean has not overridden the toString method when I > try to display my JTree using these beans all i get is the Objects > memory address which I am not really interested. > > Now since I have lot of swing based componenets which have similar > behaviour I am wondering how can I override toString method to get > desired results ie may be return a propertyName say for example > > public String toString(){ > return this.get("person_Name"); > } > > BTW: Remember that the Bean is same across the project and I cannot do > this method in the bean since then for say another usecase this property > does not even exist. > > If I am not clear please ask me again. > > I am really stuck and really need a solution. > > Thanx in advace. > > dumdum420 > > _________________________________________________________________ > online games and music with a high-speed Internet connection! Prices > start at less than $1 a day average. https://broadband.msn.com (Prices > may vary by service area.) --------------------------------------------------------------------- To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-user-help@jakarta.apache.org