🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #8138

Re: How to test if object has an exact type

#8138
From: Joi Ellis [TeamB]
Date: Fri, 20 Apr 2001 13:46
15 lines
1244 bytes
David Crocker <dcrocker@imsltd.com> wrote:
> Is there a better way? Does Java provide any other way of obtaining the
> Class object for a given type? Any other ideas or advice will be
> appreciated.

I've used a construct something like this:
if ( foo.getClass() == javax.swing.JFrame.class ) {
  // it's a JFrame.
}

-- 
Joi Ellis (TeamB) 
No direct email, please.
For best results, post on news server newsgroups.borland.com!
Newsgroup Info: http://www.borland.com/newsgroups/guide.html
Technical Details
Message-ID: <3ae03dc2$1_2@dnews>
Path: arc1-ca.pugleaf.net!supernews.google.com!newsfeed.google.com!sn-xit-03!supernews.com!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews!not-for-mail
References: <3ae038b6$1_2@dnews>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,6c5d8e5267379055
X-Google-Attributes: gidf74b3,public
X-Google-ArrivalTime: 2001-04-20 06:54:22 PST
Message-ID: <3ae03dc2$1_2@dnews>
From: "Joi Ellis [TeamB]" <joi@aravox.com>
Subject: Re: How to test if object has an exact type
Newsgroups: borland.public.jbuilder.java.language
References: <3ae038b6$1_2@dnews>
User-Agent: tin/1.4.2-20000205 ("Possession") (UNIX) (Linux/2.2.16-3 (i686))
NNTP-Posting-Host: 209.46.41.66
Date: 20 Apr 2001 06:46:42 -0700
X-Trace: dnews 987774402 209.46.41.66 (20 Apr 2001 06:46:42 -0700)
Lines: 15
Path: arc1-ca.pugleaf.net!supernews.google.com!newsfeed.google.com!sn-xit-03!supernews.com!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews!not-for-mail