Hi. I'm trying to build a simple swing app, and i'm trying to use SilkDI for dependency injection.
Many concepts behind silk sound very logical to me (no field injection, no setter injection, etc). I simply do not understand how to use it for my needs.
I have a gui that is builded "in cascade". So i have constructors with many arguments of the same type.
eg :
class FileMenuBuilder implements IMenuProvider {
private JMenu fileMenu_;
public FileMenuBuilder(ActionListener fileOpenListener, ActionListener fileSaveListener, ActionListener fileCloseListener, ActionListener fileQuitListener)
{
// ... actually build the menu
}
@Override
public JMenu getMenu() {
return fileMenu_;
}
}
Somewhere there will also be a EditMenuBuilder, HelpMenuBuilder, etc ... and a final MenuBuilder that takes all the JMenu and "assembles" the JMenuBar.
It would be illogical to me to extend JMenu since i'm just constructing the gui of my app (and not adding new features to the class JMenu).
But i have many parameters of the same type. How can i tell SilkDI to use the declared parameters in a particolar order?
And also : how can i tell silk to use the getMenu object of my FileMenuBuilder, EditMenuBuilder, HelpMenuBuilder for constructing my MenuBuilder instance?
Thanks for the reply.
-Marco