Hi list. This workaround will help creating composition/delegation classes until IntelliJ decides if they want to support composition patterns. Say I want to create a class called EnclosingClass that delegates off to BaseClass.
1) Create new class EnclosingClass using Alt-Insert. 2) Type: extends BaseClass 3) Use Ctrl-O to drop in all the methods you wish to expose in the enclosing class. (Note, this will also offer you protected methods, which you won't want.) 4) Write a getDelegate() method to return a BaseClass instance - this can even lazy-create your delegate class if you like. 5) Globally replace super with getDelegate() 6) Remove the "extends BaseClass" declaration. Cheers, Dan/tastapod > -----Original Message----- > From: Andy Byala [mailto:[EMAIL PROTECTED]] > Sent: 18 November 2001 08:11 > To: [EMAIL PROTECTED] > Subject: [Eap-list] re: support for creating a class using composition > > > +1 enthusiastically. I use this strategy for > composition and (especially) delegation all over the > place, and having IDEA help out would be fantastic. > > BTW, many thanks to IntelliJ for making a truly > superior product. My dev team has been using IDEA for > a few months now, and even now it's not at all > uncommon for someone to yell out how much we love this > new feature we just discovered. Keep up the great > work! > > Andy > > >hey all, > > >I'm not sure if this already exists - if it does, > >just tell me where to > >look for it... > > > >what I'm after is something similar to generate > >getter/setters, but that > >would delegate to another class to provide the > >implementation. For > >instance: > > > >public class A > >{ > > private int foo; > > public void setFoo(int foo) { this.foo = foo; } > > public int getFoo() { return foo; } > >} > > > >public class B > >{ > > public A a = new A(); > > public void setFoo(int foo) { a.setFoo(a); } > > public int getFoo() { return a.getFoo(); } > >} > > > >so I suppose I want something like "expose methods > >from member"... does > >this exist? if not, does anyone think its > worthwhile? > > > >cheesr > >dim > > > __________________________________________________ > Do You Yahoo!? > Find the one for you at Yahoo! Personals > http://personals.yahoo.com > > _______________________________________________ > Eap-list mailing list > [EMAIL PROTECTED] > http://www.intellij.com/mailman/listinfo/eap-list > *************************************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify [EMAIL PROTECTED] immediately. This footnote also confirms that this email message has been swept for the presence of computer viruses. *************************************************************************************** _______________________________________________ Eap-list mailing list [EMAIL PROTECTED] http://www.intellij.com/mailman/listinfo/eap-list
