I haven't tried this but it might be possible... some of the controls experts may have some better information. The @ControlReferences annotation allows you to list controls used by a client. This is used in assembly to make sure that the correct control dependencies are available sine you will not be using @Control. Then you will need to instantiate the desired control programmatically.
Maybe Chris Hogue's blog about testing a Service Control will help... http://dev2dev.bea.com/blog/hogue/archive/2007/02/testing_a_servi.html Good luck, Calrin On 9/6/07, Christopher Snow <[EMAIL PROTECTED]> wrote: > I have a base control (MyCustomControl) and two Controls that extend it > (MyExtendedControl1 and MyExtendedControl2). > > At runtime, I would like to be able to choose which sub-implementation to use. > Is this possible? > > Thanks in advance, > > Chris > > > > @ControlReferences({ > MyCustomControl.class, > MyExtendedControl1.class, > MyExtendedControl2.class > }) > > public class MyClass() { > > MyCustomControl myControl = null; > > MyClass() { > if (somelogic) { > setControl1; > } else { > setControl2; > } > myControl.hello() > } > > private void setControl1() { > myControl = (MyExtendedControl1) Controls.instantiate( > getClass().getClassLoader(), "sample.MyExtendedControl1Bean", null); > } > > private void setControl2() { > myControl = (MyExtendedControl2) Controls.instantiate( > getClass().getClassLoader(), "sample.MyExtendedControl2Bean", null); > } > } > > ---------------------------------------------------------------- > This message was sent using IMP, the Internet Messaging Program. > > -- > This message has been scanned for viruses and > dangerous content by MailScanner, and is > believed to be clean. > >
