Groovy Import Aliasing in the IDE

Comments:

Geertjan

I did not get the use case of this feature.

Do u mean to say that instead of using
ItemLabelAnchor ila = ....

I can use
ILA ila = ...

If so this does NOT make good reading/maintenance as well

Posted by swaroop belur on August 20, 2007 at 04:59 PM PDT #

Swaroop,

My understanding is that import aliasing exists to allow otherwise identical class names to be disambiguated without having to provide a full class name and the chance to reduce particularly long class names to something more memorable.

For example,

import java.util.Label
import com.company.acme.Label as AcmeLabel
import org.jfree.chart.labels.StandardCategoryItemLabelGenerator as LabelGenerator

Posted by Daniel Sheppard on August 20, 2007 at 05:32 PM PDT #

swaroop, what Daniel writes above is my understanding too. Plus, it's easier to write "BF" than "BorderFactory". But, I didn't invent this, so don't blame me if you don't like it. That's Groovy. Look up Groovy and write to those guys if you have problems with this. In terms of reading/maintenance, the screenshot above shows you quite clearly how the IDE can help you by providing syntax coloring so that at one glance you can see your import aliases.

Posted by Geertjan on August 20, 2007 at 07:08 PM PDT #

Could I ask which plugin this is ? Is this the Coyote plugin you mentioned in some previous post or is this some other dedicated Groovy/Grails plugin ?

Posted by Willem on August 22, 2007 at 05:34 AM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
12
13
14
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today