🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.java
Article #153935

Re: Jak to ugryźć jedną metodą -Java/Delphi

#153935
From: J-23
Date: Fri, 06 Dec 2013 18:21
38 lines
2012 bytes
W dniu 06.12.2013 18:06, Piotr Rezmer pisze:
> J-23 pisze:
>
>> Piszę w GWT tam nie ma czegoś takiego jak *instanceof*. Gdyby był nie
>> było by problemu :)
>
> A jak to się ma do informacji w wątku:
> https://groups.google.com/forum/#!topic/google-web-toolkit/YQdrrkxOAuA
>
>
Sprawdzałem to wcześniej ale to nie działa. (Może coś ja knocę, już sam 
nie wiem)

Why not just use the native instanceof?

Button b = new Button();
if (b instanceof Widget) {
   /* the code should drop in here */
}




ale dałem najprostszy kod jaki się dało i nic...

     public boolean add(Widget widget) {
         if (widget instanceof Widget) {
             System.out.println("WIDGET");
             return super.add(widget);
         } else {
             super.add(widget);
         }
         return false;
     }

powinien być napis "WIDGET" jesli się zgadza a nie ma

Pozdrawiam
Technical Details
Message-ID: <l7t5ed$gf9$1@mx1.internetia.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!agh.edu.pl!news.agh.edu.pl!newsfeed2.atman.pl!newsfeed.atman.pl!news.supermedia.pl!news.nask.pl!news.nask.org.pl!news.internetia.pl!not-for-mail
References: <l7svf1$tkd$1@mx1.internetia.pl> <l7t07n$ri9$1@node2.news.atman.pl>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!agh.edu.pl!news.agh.edu.pl!newsfeed2.atman.pl!newsfeed.atman.pl!news.supermedia.pl!news.nask.pl!news.nask.org.pl!news.internetia.pl!not-for-mail
From: J-23 <baczeklu@o2.pl>
Newsgroups: pl.comp.lang.java,pl.comp.lang.delphi
Subject: Re: Jak to ugryźć jedną metodą
 -Java/Delphi
Date: Fri, 06 Dec 2013 19:21:29 +0100
Organization: Netia S.A.
Lines: 38
Message-ID: <l7t5ed$gf9$1@mx1.internetia.pl>
References: <l7svf1$tkd$1@mx1.internetia.pl> <l7t07n$ri9$1@node2.news.atman.pl>
NNTP-Posting-Host: 77-253-116-160.adsl.inetia.pl
Mime-Version: 1.0
X-Trace: mx1.internetia.pl 1386354957 16873 77.253.116.160 (6 Dec 2013 18:35:57 GMT)
X-Complaints-To: abuse@inetia.pl
NNTP-Posting-Date: Fri, 6 Dec 2013 18:35:57 +0000 (UTC)
In-Reply-To: <l7t07n$ri9$1@node2.news.atman.pl>
X-Tech-Contact: usenet@internetia.pl
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0
X-Server-Info: http://www.internetia.pl/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit