The Artima Developer Community
Sponsored Link

Java Buzz Forum
Java does Duck Typing

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Scott Delap

Posts: 1154
Nickname: scottdelap
Registered: Sep, 2004

Client / Server application developer.
Java does Duck Typing Posted: May 3, 2005 11:19 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Scott Delap.
Original Post: Java does Duck Typing
Feed Title: ClientJava.com
Feed URL: http://www.clientjava.com/archives/wireless_mobile.rdf
Feed Description: Client/Desktop Related Java Development
Latest Java Buzz Posts
Latest Java Buzz Posts by Scott Delap
Latest Posts From ClientJava.com

Advertisement

Java does Duck Typing
As promised, this is the followup to Duck Typing helps automatically dispose SWT Images. Here, we will show how to implement Duck Types in Java ...

So, when working with SWT, you quickly learn that any time you want to set the display text of something, you look for a Text property to set. And in the case of setting display text, you would be right 100% of the time.

Unfortunately, this does not hold true for programs that want to manipulate SWT controls. There is no ITextField interface that is implemented by everything with a Text property, for example. And, as we mentioned last time, it would be silly for such a thing to exist, because there are so many naming conventions applied so consistently throughout SWT that every SWT class would be cluttered with interface implementations.

Consequently, it would be nice to be able to define an ITextField interface after the fact and apply it to any SWT class that happens to implement all of the methods specified by the ITextField interface.

Read: Java does Duck Typing

Topic: Major Java 1.6 Priority: Windows Look and Feel Previous Topic   Next Topic Topic: Links for 2005-04-26 [del.icio.us]

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use